public static void SetDialogResult(RadWindow radWindow, bool?value) { if (radWindow != null) { radWindow.SetValue(RadWindow.DialogResultProperty, value); if (value != null) { radWindow.Close(); } } }
private static RadWindow EnsureWindow(object model, object view) { var window = view as RadWindow; if (window == null) { window = new RadWindow { Content = view }; window.SetValue(View.IsGeneratedProperty, true); } return window; }
private static RadWindow EnsureWindow(object model, object view) { var window = view as RadWindow; if (window == null) { window = new RadWindow { Content = view, WindowStartupLocation = WindowStartupLocation.CenterScreen }; window.SetValue(View.IsGeneratedProperty, true); } return(window); }
/// <summary> /// Makes sure the view is a window is is wrapped by one. /// </summary> /// <param name="model">The view model.</param> /// <param name="view">The view.</param> /// <param name="isDialog">Whethor or not the window is being shown as a dialog.</param> /// <returns>The window.</returns> protected virtual RadWindow EnsureRadWindow(object model, object view, bool isDialog) { var window = view as RadWindow; if (window == null) { var contentElement = view as FrameworkElement; if (contentElement == null) { throw new ArgumentNullException("view"); } window = new RadWindow { Content = view, SizeToContent = true, }; AdjustWindowAndContentSize(window, contentElement); window.SetValue(View.IsGeneratedProperty, true); var owner = GetActiveWindow(); if (owner != null) { window.WindowStartupLocation = WindowStartupLocation.CenterOwner; window.Owner = owner; } else { window.WindowStartupLocation = WindowStartupLocation.CenterScreen; } } else { var owner = GetActiveWindow(); if (owner != null && isDialog) { window.Owner = owner; } } return(window); }
/// <summary> /// Makes sure the view is a window is is wrapped by one. /// </summary> /// <param name="model">The view model.</param> /// <param name="view">The view.</param> /// <param name="isDialog">Whethor or not the window is being shown as a dialog.</param> /// <returns>The window.</returns> protected virtual RadWindow EnsureRadWindow(object model, object view, bool isDialog) { var window = view as RadWindow; if (window == null) { var contentElement = view as FrameworkElement; if (contentElement == null) throw new ArgumentNullException("view"); window = new RadWindow { Content = view, SizeToContent = true, }; AdjustWindowAndContentSize(window, contentElement); window.SetValue(View.IsGeneratedProperty, true); var owner = GetActiveWindow(); if (owner != null) { window.WindowStartupLocation = WindowStartupLocation.CenterOwner; window.Owner = owner; } else { window.WindowStartupLocation = WindowStartupLocation.CenterScreen; } } else { var owner = GetActiveWindow(); if (owner != null && isDialog) { window.Owner = owner; } } return window; }
/// <summary> /// Ensures the window. /// </summary> /// <param name="model">The model.</param> /// <param name="view">The view.</param> /// <returns></returns> private static RadWindow EnsureWindow(object model, object view) { var window = view as RadWindow; if (window == null) { window = new RadWindow { HideMaximizeButton = true, HideMinimizeButton = true, IsRestricted = true, IsRestrictedWhenMaximized = true, Content = view, WindowStartupLocation = WindowStartupLocation.CenterScreen }; window.SetValue(View.IsGeneratedProperty, true); //window.Top = Math.Round((Application.Current.MainWindow.Height / 2) - (155 / 2), 0); //window.Left = Math.Round((Application.Current.MainWindow.Width / 2) - (350 / 2), 0); } return window; }