Skip to content

Commit

Permalink
Fixed crash clicking maximize button with ResizeMode = CanMinimize
Browse files Browse the repository at this point in the history
  • Loading branch information
NotYoojun committed Oct 6, 2023
1 parent cd21355 commit f6bdef3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -239,21 +239,18 @@ public static void SetCornerStyle(Window window, WindowCornerStyle value)

#region FixMaximizedWindow

[EditorBrowsable(EditorBrowsableState.Never)]
public static readonly DependencyProperty FixMaximizedWindowProperty =
DependencyProperty.RegisterAttached(
"FixMaximizedWindow",
typeof(bool),
typeof(WindowHelper),
new PropertyMetadata(false, OnFixMaximizedWindowChanged));

[EditorBrowsable(EditorBrowsableState.Never)]
public static bool GetFixMaximizedWindow(Window window)
{
return (bool)window.GetValue(FixMaximizedWindowProperty);
}

[EditorBrowsable(EditorBrowsableState.Never)]
public static void SetFixMaximizedWindow(Window window, bool value)
{
window.SetValue(FixMaximizedWindowProperty, value);
Expand Down
2 changes: 1 addition & 1 deletion source/iNKORE.UI.WPF.Modern/TitleBar/SnapLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ private bool IsOverButton(IntPtr wParam, IntPtr lParam)

private void RaiseButtonClick()
{
if (new ButtonAutomationPeer(_button).GetPattern(PatternInterface.Invoke) is IInvokeProvider invokeProv)
if (_button.IsEnabled && new ButtonAutomationPeer(_button).GetPattern(PatternInterface.Invoke) is IInvokeProvider invokeProv)
invokeProv?.Invoke();
}

Expand Down
3 changes: 2 additions & 1 deletion source/samples/WpfApp1/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
xmlns:local="clr-namespace:WpfApp1" xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800"
ResizeMode="CanMinimize"
ui:ThemeManager.IsThemeAware="True" ui:TitleBar.Height="40"
ui:TitleBar.ExtendViewIntoTitleBar="False"
ui:WindowHelper.SystemBackdropType="Mica"
ui:TitleBar.IsBackButtonVisible="False"
ui:WindowHelper.UseModernWindowStyle="True"
ui:WindowHelper.CornerStyle="RoundSmall">
ui:WindowHelper.CornerStyle="DoNotRound" Background="{x:Null}">
<Grid>
<ComboBox SelectionChanged="ComboBox_SelectionChanged" Height="35">
<ComboBoxItem Content="Item1"/>
Expand Down

0 comments on commit f6bdef3

Please sign in to comment.