private static WindowStyleFlag GetWindowStyle(DependencyObject obj, WindowStyleFlag windowStyle, DependencyPropertyChangedEventArgs ex) { var style = windowStyle; switch (ex.Property.Name) { case "MinimizeBox": if ((bool)obj.GetValue(MinimizeBoxProperty)) { style |= WindowStyleFlag.WS_MINIMIZEBOX; } else { style ^= WindowStyleFlag.WS_MINIMIZEBOX; } break; case "MaximizeBox": if ((bool)obj.GetValue(MaximizeBoxProperty)) { style |= WindowStyleFlag.WS_MAXIMIZEBOX; } else { style ^= WindowStyleFlag.WS_MAXIMIZEBOX; } break; case "ControlBox": if ((bool)obj.GetValue(ControlBoxProperty)) { style |= WindowStyleFlag.WS_SYSMENU; } else { style ^= WindowStyleFlag.WS_SYSMENU; } break; } return(style); }
private static extern uint SetWindowLong(IntPtr hWnd, int index, WindowStyleFlag dwLong);