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