double leftmargin = (Window.Current.Bounds.Width / 2.0) - (contentDialogReference.ActualWidth / 2.0);
double topmargin = (Window.Current.Bounds.Height / 2.0) - (contentDialogReference.ActualHeight / 2.0);
contentDialogReference.Margin = new Thickness(leftmargin, topmargin, 0, 0);