public ExtendedResizeWindow(Direction dir) { Direction = dir; SetStyle(dir); Title = "Felix Shadow Window"; Background = Brushes.Transparent; ShowInTaskbar = false; ShowActivated = false; ResizeMode = ResizeMode.NoResize; WindowStyle = WindowStyle.None; WindowChrome.SetWindowChrome(this, new WindowChrome() { GlassFrameThickness = new Thickness(-1), ResizeBorderThickness = new Thickness(0), CaptionHeight = 0 }); SnapsToDevicePixels = true; GlowBorder = new Border() { SnapsToDevicePixels = true, IsHitTestVisible = false, Background = Brushes.Black, }; Content = GlowBorder; }
private void MainWindow_StateChanged(object sender, EventArgs e) { if (WindowState == WindowState.Maximized) { WindowChrome.SetWindowChrome(this, new WindowChrome() { CaptionHeight = 0, ResizeBorderThickness = new Thickness(0) }); Visibility = Visibility.Collapsed; ResizeMode = ResizeMode.NoResize; fullscreenButton.Visibility = Visibility.Collapsed; resizeWindowButton.Visibility = Visibility.Visible; Visibility = Visibility.Visible; } else { WindowChrome.SetWindowChrome(this, new WindowChrome() { CaptionHeight = 0, ResizeBorderThickness = new Thickness(windowBorderThickness) }); ResizeMode = ResizeMode.CanResize; fullscreenButton.Visibility = Visibility.Visible; resizeWindowButton.Visibility = Visibility.Collapsed; } updateActivePanelIndicator(); }
public CustomChromeWindow() : base() { WindowChrome.SetWindowChrome(this, new WindowChrome() { CaptionHeight = 3, ResizeBorderThickness = new Thickness(5), NonClientFrameEdges = NonClientFrameEdges.None }); }
/// <summary> /// Hides the Title bat from this WPF Window. This should be placed on Loaded event OR Rendered event, NOT ON THE CONSTRUCTOR /// </summary> private void HideTitleBar(Window window) { var wChrome = new WindowChrome(); wChrome.CaptionHeight = 0; WindowChrome.SetWindowChrome(window, wChrome); }
/// <summary> /// 设置窗口边框用于拖拽改变大小 /// </summary> /// <param name="window"></param> /// <param name="wc"></param> public static void SetWindowChrome(this Window window, WindowChrome wc = null) { if (window == null) return; if (wc == null) { switch (window.ResizeMode) { case ResizeMode.NoResize: case ResizeMode.CanResizeWithGrip: case ResizeMode.CanMinimize: wc = new WindowChrome { CaptionHeight = 0, GlassFrameThickness = new Thickness(0), CornerRadius = new CornerRadius(0), UseAeroCaptionButtons = true, ResizeBorderThickness = new Thickness(0) }; break; case ResizeMode.CanResize: wc = new WindowChrome { CaptionHeight = 0, GlassFrameThickness = new Thickness(7), CornerRadius = new CornerRadius(0), UseAeroCaptionButtons = true, ResizeBorderThickness = new Thickness(6) }; break; } } WindowChrome.SetWindowChrome(window, wc); }
private void Initialize() { #if NETFX4 // NOTE: Lack of contracts: SystemParameters2.Current must ensure non-null value Contract.Assume(SystemParameters2.Current != null); #endif _chrome = new WindowChrome { #if NETFX4 CaptionHeight = SystemParameters2.Current.WindowCaptionHeight, #elif NETFX45 CaptionHeight = SystemParameters.WindowCaptionHeight, #endif CornerRadius = new CornerRadius(0d), GlassFrameThickness = new Thickness(0d), NonClientFrameEdges = NonClientFrameEdges.None, ResizeBorderThickness = Parameters.Window.GetResizeBorderThickness(this), UseAeroCaptionButtons = false }; _chrome.Freeze(); if (WindowChrome.GetWindowChrome(this) == null) { WindowChrome.SetWindowChrome(this, _chrome); } Initialized += OnInitializedInternal; Loaded += OnLoadedInternal; var resizeBorderThicknessPropertyDescriptor = DependencyPropertyDescriptor.FromProperty(Parameters.Window.ResizeBorderThicknessProperty, typeof(Window)); if (resizeBorderThicknessPropertyDescriptor != null) { resizeBorderThicknessPropertyDescriptor.AddValueChanged(this, OnResizeBorderThicknessChanged); } }
public override void OnApplyTemplate() { base.OnApplyTemplate(); //设置边框 wndChrome.CaptionHeight = this.CaptionHeight; wndChrome.ResizeBorderThickness = this.BorderSize; wndChrome.GlassFrameThickness = new Thickness(1); wndChrome.NonClientFrameEdges = NonClientFrameEdges.None; wndChrome.CornerRadius = new CornerRadius(0); WindowChrome.SetWindowChrome(Window.GetWindow(this), this.wndChrome); //注册控件的事件 minBtn = GetTemplateChild("PART_MINBTN") as Button; maxBtn = GetTemplateChild("PART_MAXBTN") as Button; closeBtn = GetTemplateChild("PART_CLOSEBTN") as Button; if (minBtn != null) { minBtn.Click += minBtn_Click; } if (maxBtn != null) { maxBtn.Click += maxBtn_Click; } if (closeBtn != null) { closeBtn.Click += closeBtn_Click; } }
//public BaseWinTitle() : base() { // //InitializeComponent(); // Background = Brushes.Transparent; // //Loaded += BaseWinTitle_Loaded; //} private void UserControl_Loaded(object sender, RoutedEventArgs e) { //throw new NotImplementedException(); //Debug.WriteLine("aa"); win = findWin(); if (win == null) { //base.OnVisualParentChanged(oldParent); return; } win.MouseLeftButtonDown += Win_MouseLeftButtonDown; win.MouseLeftButtonUp += Win_MouseLeftButtonUp; WindowChrome chrome = WindowChrome.GetWindowChrome(win); if (chrome == null) { chrome = new WindowChrome(); chrome.CaptionHeight = 0; chrome.CornerRadius = new CornerRadius(0); chrome.GlassFrameThickness = new Thickness(1); chrome.NonClientFrameEdges = NonClientFrameEdges.None; //base.OnVisualParentChanged(oldParent); //return; WindowChrome.SetWindowChrome(win, chrome); } chrome.ResizeBorderThickness = oldTickness; // Call base class to perform standard event handling. //base.OnVisualParentChanged(oldParent); }
private void SetMember(Window owner, string title, MessageBoxButton msgButton, DialogBaseViewModel vm, ResizeMode mode) { if (owner != null) { this.Owner = owner; this.WindowStartupLocation = WindowStartupLocation.CenterOwner; } else { this.Topmost = true; this.WindowStartupLocation = WindowStartupLocation.CenterScreen; } WindowChrome.SetWindowChrome(this, new WindowChrome { NonClientFrameEdges = NonClientFrameEdges.None, CaptionHeight = 26, UseAeroCaptionButtons = false, ResizeBorderThickness = new Thickness(mode == ResizeMode.NoResize ? 0 : 5) }); this.Title = title; this.ResizeMode = mode; this.DataContext = vm; this.MessageBoxButtonInfo = msgButton; this.ConfirmCommand = vm.ConfirmCommand; this.CancelCommand = vm.CancelCommand; }
/// <summary> /// Shows the window. /// </summary> void ShowWindow() { win = new Window(); Label label = new Label(); label.Content = "Please Wait...Loading Modules..."; label.FontWeight = FontWeights.Bold; label.HorizontalAlignment = HorizontalAlignment.Center; label.VerticalAlignment = VerticalAlignment.Center; label.FontSize = 14; label.Foreground = System.Windows.Media.Brushes.Black; label.FontFamily = new FontFamily("Verdana"); win.WindowStartupLocation = WindowStartupLocation.CenterScreen; win.BorderBrush = Brushes.Gray; win.BorderThickness = new Thickness(0.8); win.WindowStyle = WindowStyle.None; win.Height = 75; win.Width = 309; win.ShowInTaskbar = false; win.Topmost = true; win.Content = label; win.Effect = new DropShadowEffect() { BlurRadius = 1, ShadowDepth = 180, Color = Colors.Black }; WindowChrome.SetWindowChrome(win, new WindowChrome() { UseAeroCaptionButtons = false }); win.Show(); }
public WindowBorderless() { var chrome = new WindowChrome { CornerRadius = new CornerRadius(), GlassFrameThickness = new Thickness(1) }; BindingOperations.SetBinding(chrome, WindowChrome.CaptionHeightProperty, new Binding(NonClientAreaHeightProperty.Name) { Source = this }); WindowChrome.SetWindowChrome(this, chrome); Loaded += delegate { _tempThickness = BorderThickness; if (WindowState == WindowState.Maximized) { BorderThickness = new Thickness(); } CommandBindings.Add(new CommandBinding(SystemCommands.MinimizeWindowCommand, (s, e) => WindowState = WindowState.Minimized)); CommandBindings.Add(new CommandBinding(SystemCommands.MaximizeWindowCommand, (s, e) => WindowState = WindowState.Maximized)); CommandBindings.Add(new CommandBinding(SystemCommands.RestoreWindowCommand, (s, e) => WindowState = WindowState.Normal)); CommandBindings.Add(new CommandBinding(SystemCommands.CloseWindowCommand, (s, e) => Close())); CommandBindings.Add(new CommandBinding(SystemCommands.ShowSystemMenuCommand, ShowSystemMenu)); }; }
void MainWindow_SourceInitialized(object sender, EventArgs e) { var helper = new WindowInteropHelper(this); var hwnd = helper.Handle; var src = HwndSource.FromHwnd(hwnd); src.CompositionTarget.BackgroundColor = Colors.Transparent; WindowChrome.SetWindowChrome(this, new WindowChrome { CaptionHeight = 500, CornerRadius = new CornerRadius(0), GlassFrameThickness = new Thickness(0), NonClientFrameEdges = NonClientFrameEdges.None, ResizeBorderThickness = new Thickness(0), UseAeroCaptionButtons = false }); GraphicsPath path = new GraphicsPath(FillMode.Alternate); path.StartFigure(); path.AddArc(new RectangleF(0, 0, 500, 500), 0, 360); path.CloseFigure(); var dbb = new DwmBlurBehind(true); dbb.SetRegion(Graphics.FromHwnd(hwnd), new Region(path)); DwmApi.DwmEnableBlurBehindWindow(hwnd, ref dbb); }
public MessageBoxWindow(string message) { InitializeComponent(); WindowChrome windowChrome = new WindowChrome() { CaptionHeight = 51, CornerRadius = new CornerRadius(0), GlassFrameThickness = new Thickness(0), NonClientFrameEdges = NonClientFrameEdges.None, ResizeBorderThickness = new Thickness(0), UseAeroCaptionButtons = false }; WindowChrome.SetWindowChrome(this, windowChrome); Message = message; rowCaption.Visibility = Visibility.Collapsed; imgIcon.Visibility = Visibility.Collapsed; SetButtons(MessageBoxButton.OK); NativeDisplay display = NativeDisplay.GetDisplayFromWindow(new WindowInteropHelper(this).Handle); MaxWidth = display.WorkingArea.Width * 0.9; MaxHeight = display.WorkingArea.Height * 0.9; }
public MainWindow() { InitializeComponent(); CommandBindings.Add(new CommandBinding(ApplicationCommands.New, OpenNewTab)); Maximized = false; if (Maximized) { WindowState = WindowState.Maximized; } else { WindowState = WindowState.Normal; } CheckForUpdates(); Loaded += MainWindow_Loaded; Pages = new List <TabView>(); Downloads1.Height = 0; WindowChrome wc = new WindowChrome(); WindowChrome.SetWindowChrome(this, wc); wc.CaptionHeight = 0; wc.UseAeroCaptionButtons = false; }
public Window() { #if NET40 var chrome = new WindowChrome { CornerRadius = new CornerRadius(), GlassFrameThickness = new Thickness(0, 0, 0, 1) }; #else var chrome = new WindowChrome { CornerRadius = new CornerRadius(), GlassFrameThickness = new Thickness(0, 0, 0, 1), UseAeroCaptionButtons = false }; #endif BindingOperations.SetBinding(chrome, WindowChrome.CaptionHeightProperty, new Binding(NonClientAreaHeightProperty.Name) { Source = this }); WindowChrome.SetWindowChrome(this, chrome); _commonPadding = Padding; Loaded += (s, e) => OnLoaded(e); }
public CustomWindow() : base() { var chrome = new WindowChrome { UseAeroCaptionButtons = false, NonClientFrameEdges = NonClientFrameEdges.Left | NonClientFrameEdges.Bottom | NonClientFrameEdges.Right, }; this._chrome = chrome; WindowChrome.SetWindowChrome(this, chrome); var commandBindings = new List <CommandBinding> { new CommandBinding(SystemCommands.MinimizeWindowCommand, ExecuteMinimizeCommand), new CommandBinding(SystemCommands.MaximizeWindowCommand, ExecuteMaximizeCommand, CanExecuteMaximizeCommand), new CommandBinding(SystemCommands.RestoreWindowCommand, ExecuteRestoreCommand), new CommandBinding(SystemCommands.CloseWindowCommand, ExecuteCloseCommand), }; this.CommandBindings.AddRange(commandBindings); double marginWidth = this._resizeBorderWidth + this._borderPadWidth; this._maximizedBorderMargin = new Thickness(this._resizeBorderWidth, marginWidth, this._resizeBorderWidth, this._resizeBorderWidth); this.SetScale(VisualTreeHelper.GetDpi(this)); }
void retrieveSettings(conf s) { (wfhRefreshDelay.Child as WinForms.NumericUpDown).Value = s.refreshDelay; (wfhMaxRefreshAttempts.Child as WinForms.NumericUpDown).Value = s.maxRefreshAttempts; if (s.borderlessWindow) { WindowStyle = WindowStyle.None; if (WindowState == WindowState.Maximized) { MainGrid.Margin = new Thickness(6); } WindowChrome.SetWindowChrome(this, new WindowChrome { CaptionHeight = 0, ResizeBorderThickness = new Thickness(5) }); BorderlessStuff.Visibility = Visibility.Visible; } else { WindowStyle = WindowStyle.SingleBorderWindow; WindowChrome.SetWindowChrome(this, null); BorderlessStuff.Visibility = Visibility.Collapsed; } Log(LogSeverity.Debug, "Retrieved user settings"); }
public MainConfigView() { InitializeComponent(); Loaded += (_, _) => { RegionManagerA.RegisterViewWithRMAware <NavigationMenuView>(RegionNames.MENU_REGION); RegionManagerA.RequestNavigate(RegionNames.SHELL_CONFIG_REGION, nameof(GeneralConfigView)); // Window Setup _window = GetWindow(this); Debug.Assert(_window != null, nameof(_window) + " != null"); _window.Background = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)); WindowChrome windowChrome = new() { ResizeBorderThickness = new Thickness(9), CaptionHeight = 0 }; WindowChrome.SetWindowChrome(_window, windowChrome); (double dpiWidthFactor, double dpiHeightFactor) = WindowHelpers.GetDpiFactors(_window); _window.CenterOnScreen(dpiWidthFactor, dpiHeightFactor); }; MouseDown += (_, e) => { if (e.ChangedButton == MouseButton.Left) { DependencyObject scope = FocusManager.GetFocusScope(Root); FocusManager.SetFocusedElement(scope, _window); _window.DragMove(); } }; }
public MainWindow(MainWindowVM viewModel, IEventAggregator eventAggregator) { this.eventAggregator = eventAggregator; InitializeComponent(); WindowChrome windowChrome = new WindowChrome() { CaptionHeight = 55, CornerRadius = new CornerRadius(0), GlassFrameThickness = new Thickness(0), NonClientFrameEdges = NonClientFrameEdges.None, ResizeBorderThickness = new Thickness(6), UseAeroCaptionButtons = false }; WindowChrome.SetWindowChrome(this, windowChrome); // Hold reference to FontAwesome library ImageAwesome.CreateImageSource(FontAwesomeIcon.Times, Brushes.Black); this.Loaded += (s, e) => { HwndSource.FromHwnd(new WindowInteropHelper(this).Handle).AddHook(new HwndSourceHook(WindowProc)); this.DataContext = viewModel; if (viewModel != null) { viewModel.Loaded(); } }; }
public MainWindow() { WinConsole.ShowConsole(); InitializeComponent(); var wc = new WindowChrome { CaptionHeight = 30, GlassFrameThickness = new Thickness(0), CornerRadius = new CornerRadius(0), UseAeroCaptionButtons = false, ResizeBorderThickness = new Thickness(5) }; WindowChrome.SetWindowChrome(this, wc); Activated += MainWindow_Activated; Deactivated += MainWindow_Deactivated; SizeChanged += MainWindow_OnSizeChanged; Client.CloseDialogPanelEvent += Client_CloseDialogPanelEvent; Client.ShowDialogPanelEvent += Client_ShowDialogPanelEvent; Client.ShowToastEvent += Client_ShowToastEvent; //基于dip决定高分屏字体 try { using (var graphics = Graphics.FromHwnd(IntPtr.Zero)) { if (Math.Abs(graphics.DpiX - 96) > 0) { TextOptions.SetTextFormattingMode(this, TextFormattingMode.Ideal); FontFamily = new FontFamily("Microsoft Yahei"); } else { TextOptions.SetTextFormattingMode(this, TextFormattingMode.Display); FontFamily = new FontFamily("SimSun"); } } } catch (Exception) { // ignored } //默认风格 _buttonStatus.Baseurl = "Resources/Icon/ControlBox/drak/"; DataContext = _buttonStatus; //初始化页面加载、方便调用UI线程委托 Common.MainWindow = this; Client.MainWindow = this; //加载login页面 LoginTabItem.ClickDown(null, null); //启动状态定时器 new Timer { Interval = 1000, Enabled = true }.Elapsed += MainWindow_Elapsed; }
private void CbBorderless_Checked(object sender, RoutedEventArgs e) { if (cbBorderless != null && BorderlessStuff != null) { if (cbBorderless.IsChecked == true) { WindowStyle = WindowStyle.None; if (WindowState == WindowState.Maximized) { MainGrid.Margin = new Thickness(6); } WindowChrome.SetWindowChrome(this, new WindowChrome { CaptionHeight = 0, ResizeBorderThickness = new Thickness(5) }); BorderlessStuff.Visibility = Visibility.Visible; } else { WindowStyle = WindowStyle.SingleBorderWindow; MainGrid.Margin = new Thickness(0); WindowChrome.SetWindowChrome(this, null); BorderlessStuff.Visibility = Visibility.Collapsed; } } }
public SideGlow(Side side) { _side = side; _canvas.Background = Brushes.Transparent; Content = _canvas; Width = Height = 0; _interopHelper = new WindowInteropHelper(this); WindowStyle = System.Windows.WindowStyle.None; AllowsTransparency = true; Background = Brushes.Transparent; ShowInTaskbar = false; InitializeAlphas(); InitializeLines(); UpdateLinesColor(); _winChrome = new WindowChrome { ResizeBorderThickness = new Thickness(0), CornerRadius = new CornerRadius(0), GlassFrameThickness = new Thickness(0), UseAeroCaptionButtons = false, CaptionHeight = 0 }; WindowChrome.SetWindowChrome(this, _winChrome); if (_side == Side.Top || _side == Side.Bottom) { Height = SIZE; } else { Width = SIZE; } }
protected void InitializeWindow() { // Create the WindowChrome this.windowChrome = new WindowChrome { CaptionHeight = 0, CornerRadius = new CornerRadius(0) }; // Assign the WindowChrome WindowChrome.SetWindowChrome(this, this.windowChrome); // ToolTips this.minimizeButton.ToolTip = this.MinimizeToolTip; this.closeButton.ToolTip = this.CloseToolTip; // IsHitTestVisibleInChromeProperty (In comment because this blocks // resizing of the window when the mouse Is over the close button) //this.minimizeButton.SetValue(WindowChrome.IsHitTestVisibleInChromeProperty, true); //this.maximizeButton.SetValue(WindowChrome.IsHitTestVisibleInChromeProperty, true); //this.closeButton.SetValue(WindowChrome.IsHitTestVisibleInChromeProperty, true); //this.windowCommands.SetValue(WindowChrome.IsHitTestVisibleInChromeProperty, true); // Handlers this.SizeChanged -= this.BorderlessWindowBase_SizeChanged; this.SizeChanged += this.BorderlessWindowBase_SizeChanged; // Store the previous BorderThickness this.previousBorderThickness = this.windowBorder.BorderThickness; // Update the Window for the first time this.UpdateWindow(); }
/// <summary> /// Handles the TitlebarHeightProperty value change. /// </summary> /// <param name="sender">The DependencyObject on which the property has changed value.</param> /// <param name="e">Event data that is issued by any event that tracks changes to the effective value of this property.</param> private static void WhenTitlebarHeightChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { // Check the new value if (e.NewValue.Equals(e.OldValue)) { return; } // Get the WindowX var swmWnd = sender as WindowX; if (swmWnd == null) { return; } // Update the WindowX chrome var swmWndChrome = WindowChrome.GetWindowChrome(swmWnd); if (swmWndChrome == null) { return; } swmWndChrome.CaptionHeight = (double)e.NewValue; WindowChrome.SetWindowChrome(swmWnd, swmWndChrome); }
public MainWindow(MainWindowVM viewModel, IEventAggregator eventAggregator, IDialogService dialogService, IRuntimeDataService runtimeDataService) { this._eventAggregator = eventAggregator; this._dialogService = dialogService; this._runtimeDataService = runtimeDataService; this.InitializeComponent(); WindowChrome windowChrome = new WindowChrome() { CaptionHeight = 55, CornerRadius = new CornerRadius(0), GlassFrameThickness = new Thickness(0), NonClientFrameEdges = NonClientFrameEdges.None, ResizeBorderThickness = new Thickness(6), UseAeroCaptionButtons = false }; WindowChrome.SetWindowChrome(this, windowChrome); // Hold reference to FontAwesome library ImageAwesome.CreateImageSource(FontAwesomeIcon.Times, Brushes.Black); this.SizeChanged += (s, e) => { if (this.WindowState == WindowState.Normal) { this.WidthNormal = this.Width; this.HeightNormal = this.Height; } }; this.LocationChanged += (s, e) => { if (this.WindowState == WindowState.Normal) { this.TopNormal = this.Top; this.LeftNormal = this.Left; } }; this.Loaded += (s, e) => { HwndSource.FromHwnd(new WindowInteropHelper(this).Handle).AddHook(new HwndSourceHook(this.WindowProc)); this.DataContext = viewModel; if (viewModel != null) { viewModel.Loaded(); } this.LoadWindowState(); }; this.Closed += (s, e) => { this.SaveWindowState(); }; }
private void Window_Loaded(object sender, RoutedEventArgs e) { WindowChrome.SetWindowChrome(this, new WindowChrome { CaptionHeight = 0 }); ShowInTaskbar = Owner == null; }
public MainWindow() { InitializeComponent(); WindowChrome.SetWindowChrome(this, new WindowChrome() { GlassFrameThickness = new Thickness(0), CaptionHeight = 0, ResizeBorderThickness = new Thickness(8), CornerRadius = new CornerRadius(0) }); }
public ExpressionWindow() : base() { TitleIcon.HorizontalAlignment = System.Windows.HorizontalAlignment.Left; TitleIcon.VerticalAlignment = System.Windows.VerticalAlignment.Center; TitleIcon.Width = 16; TitleIcon.Height = 16; TitleIcon.Margin = new Thickness(8, 0, 0, 0); this.Icon = Imaging.CreateBitmapSourceFromHIcon( System.Drawing.Icon.ExtractAssociatedIcon(Assembly.GetEntryAssembly().Location).Handle, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions() ); TitleIcon.Source = this.Icon; TitleIcon.SetBinding(Image.SourceProperty, new Binding() { Path = new PropertyPath("Icon"), RelativeSource = new RelativeSource() { AncestorType = typeof(ExpressionWindow), Mode = RelativeSourceMode.FindAncestor }, Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }); this.MinWidth = 50; this.MinHeight = TITLE_BAR_HEIGHT; IsColorPickerEnabled = true; IsModal = false; Window_TitleLabel.SetBinding(Label.ContentProperty, new Binding() { Path = new PropertyPath("Title"), RelativeSource = new RelativeSource() { AncestorType = typeof(ExpressionWindow), Mode = RelativeSourceMode.FindAncestor }, Mode = BindingMode.TwoWay, UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged }); if (FrameLoaded) { themeColor = ((ExpressionWindow)Application.Current.MainWindow).ThemeColor; } else { ThemeColor = DEFAULT_COLOR; FrameLoaded = true; } Chrome = new WindowChrome(); Chrome.CaptionHeight = TITLE_BAR_HEIGHT; Chrome.CornerRadius = new CornerRadius(0); Chrome.ResizeBorderThickness = new Thickness(RESIZE_HANDLE_SIZE); Chrome.GlassFrameThickness = new Thickness(0); WindowChrome.SetWindowChrome(this, Chrome); Initialize(); Application.Current.Deactivated += Current_Deactivated; Application.Current.Activated += Current_Activated; }
private void _headerPanel_SizeChanged(object sender, SizeChangedEventArgs e) { if (_headerElement is not null && e.HeightChanged) { var windowChrome = WindowChrome.GetWindowChrome(this); windowChrome.CaptionHeight = e.NewSize.Height - windowChrome.ResizeBorderThickness.Top; WindowChrome.SetWindowChrome(this, windowChrome); } }
public SimpleNoteWindowBlack(SimpleNoteViewModel noteViewModel) { InitializeComponent(); this.DataContext = noteViewModel; WindowChrome windowChrome = new WindowChrome(); windowChrome.CaptionHeight = 0; WindowChrome.SetWindowChrome(this, windowChrome); }