private void UpdateIsCaptionBarHeight() { var chrome = ShellChrome.GetWindowChrome(this); if (chrome == null) { return; } var captionBar = this._captionBar; if (captionBar != null) { if (this.SystemDpi.Y > 0) { chrome.CaptionHeight = captionBar.ActualHeight * this.DpiScaleTransform.Value.M22; } else { chrome.CaptionHeight = captionBar.ActualHeight; } } else { chrome.CaptionHeight = 0; } }
private static void IsCaptionBarChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { var instance = d as FrameworkElement; if (instance == null) { return; } var window = GetWindow(instance) as MetroWindow; if (window == null) { return; } window.captionBar = (bool)e.NewValue ? instance : null; instance.Loaded += (sender, args) => { var chrome = ShellChrome.GetWindowChrome(window); if (chrome != null) { chrome.CaptionHeight = instance.ActualHeight; } }; }