protected override Window EnsureWindow(object model, object view, bool isDialog) { var window = view as Window; if (window == null) { var metroWindow = new MetroWindow { Content = view, SizeToContent = SizeToContent.WidthAndHeight, TitlebarHeight = 0 }; window = metroWindow; //Interaction.GetBehaviors(metroWindow).Add(new GlowWindowBehavior()); metroWindow.SetValue(MoveableWindowBehavior.IsEnabledProperty, true); metroWindow.SetValue(View.IsGeneratedProperty, true); var owner = InferOwnerOf(window); if (owner != null) { window.WindowStartupLocation = WindowStartupLocation.CenterOwner; window.Owner = owner; } else window.WindowStartupLocation = WindowStartupLocation.CenterScreen; } else { var owner = InferOwnerOf(window); if ((owner != null) && isDialog) window.Owner = owner; } SetupRxWindow(model, view, window); return window; }
protected override Window EnsureWindow(object model, object view, bool isDialog) { var window = view as MetroWindow; if (window == null) { window = new MetroWindow { Content = view, }; window.SetValue(View.IsGeneratedProperty, true); window.Resources.MergedDictionaries.Add(this.themeManager.GetThemeResources()); var owner = this.InferOwnerOf(window); if (owner != null) { window.WindowStartupLocation = WindowStartupLocation.CenterOwner; window.ShowInTaskbar = false; window.Owner = owner; } else { window.WindowStartupLocation = WindowStartupLocation.CenterScreen; } } else { var owner2 = this.InferOwnerOf(window); if (owner2 != null && isDialog) { window.ShowInTaskbar = false; window.Owner = owner2; } } return window; }
protected override Window EnsureWindow(object model, object view, bool isDialog) { var metroWindow = view as MetroWindow; if (metroWindow == null) { var userControl = view as UserControl; double minHeight = 150D; double minWidth = 500D; double? height = null; double? width = null; if (userControl != null) { minHeight = userControl.MinHeight; minWidth = userControl.MinWidth; height = userControl.Height; width = userControl.Width; } metroWindow = new MetroWindow { Content = view, SizeToContent = SizeToContent.Manual, MinHeight = minHeight, MinWidth = minWidth, SaveWindowPosition = true }; if (height.HasValue && width.HasValue) { metroWindow.Height = height.Value; metroWindow.Width = width.Value; } foreach (var resourceDict in _resources) { metroWindow.Resources.MergedDictionaries.Add(resourceDict); } metroWindow.SetValue(View.IsGeneratedProperty, true); var owner = this.InferOwnerOf(metroWindow); if (owner != null) { metroWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; metroWindow.Owner = owner; } else { metroWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen; } } else { var owner = this.InferOwnerOf(metroWindow); if (owner != null && isDialog) metroWindow.Owner = owner; } return metroWindow; }
private MetroWindow CreateMetroWindow(object view) { var metroWindow = new MetroWindow { Content = view, WindowStartupLocation = WindowStartupLocation.CenterScreen }; metroWindow.SetValue(View.IsGeneratedProperty, true); AddMetroResources(metroWindow); var owner = InferOwnerOf(metroWindow); if (owner != null) { metroWindow.Owner = owner; metroWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; } return metroWindow; }
protected override Window EnsureWindow(object model, object view, bool isDialog) { if (!isDialog) return base.EnsureWindow(model, view, isDialog); var window = view as MetroWindow; if (window == null) { var userControl = view as UserControl; var appShell = IoC.Get<MainViewModel>() as IViewAware; //var scrollViewer = new ScrollViewer { Content = view }; window = new MetroWindow { //Content = scrollViewer, Content = view, SizeToContent = SizeToContent.WidthAndHeight, WindowStartupLocation = WindowStartupLocation.CenterOwner }; if (userControl != null) { window.MinHeight = userControl.MinHeight; window.MinWidth = userControl.MinWidth; } //scrollViewer.SetValue(View.IsGeneratedProperty, true); window.SetValue(View.IsGeneratedProperty, true); window.Owner = appShell.GetView() as Window; window.ShowCloseButton = false; window.ShowMaxRestoreButton = false; window.ShowMinButton = false; window.GlowBrush = new SolidColorBrush(Colors.Gray); } return window; }