public WindowHeaderView(DefinedWindowType definedWindowType) { InitializeComponent(); if (definedWindowType == DefinedWindowType.GrayTitleDialog) { MinimizeButton.Visibility = Visibility.Collapsed; } }
private static void SetWindowGrayStyle(Window window, DefinedWindowType definedWindowType) { window.BorderBrush = (Brush) new BrushConverter().ConvertFromString("#D0D1D6"); var rootBorder = new Border() { BorderBrush = Brushes.Gainsboro, BorderThickness = new Thickness(1) }; var mainGrid = new Grid(); mainGrid.Background = Brushes.White; mainGrid.ClipToBounds = true; mainGrid.RowDefinitions.Add(new RowDefinition() { Height = GridLength.Auto }); mainGrid.RowDefinitions.Add(new RowDefinition()); WindowChrome.SetIsHitTestVisibleInChrome(window, true); rootBorder.Child = mainGrid; var windowHeaderView = new WindowHeaderView(definedWindowType); windowHeaderView.SetValue(Grid.RowProperty, 0); mainGrid.Children.Add(windowHeaderView); var contentGrid = new Grid(); contentGrid.SetValue(Grid.RowProperty, 1); if (window.Content != null && window.Content is UIElement uiElement) { window.Content = null; contentGrid.Children.Add(uiElement); } mainGrid.Children.Add(contentGrid); window.Content = rootBorder; }
public static void SetDefinedWindowType(DependencyObject element, DefinedWindowType value) { element.SetValue(DefinedWindowTypeProperty, value); }