private static void OnRestoreButtonStylePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var window = (FloatingWindow)d; if (window != null) { Style style = e.NewValue as Style; window.CloseButtonStyle = style; if (window.restoreButton != null) window.restoreButton.Style = style; } }