diff --git a/src/MahApps.Metro.Samples/MahApps.Metro.Demo/MainWindow.xaml b/src/MahApps.Metro.Samples/MahApps.Metro.Demo/MainWindow.xaml index 3e0d472798..85ce7042c9 100644 --- a/src/MahApps.Metro.Samples/MahApps.Metro.Demo/MainWindow.xaml +++ b/src/MahApps.Metro.Samples/MahApps.Metro.Demo/MainWindow.xaml @@ -227,6 +227,13 @@ Header="Window icon: no scale, smaller frame" IsCheckable="True" IsChecked="{Binding IsNoScaleSmallerFrame, Mode=OneWay}" /> + + + diff --git a/src/MahApps.Metro/Controls/MetroWindow.cs b/src/MahApps.Metro/Controls/MetroWindow.cs index 643f780f20..7420e087cd 100644 --- a/src/MahApps.Metro/Controls/MetroWindow.cs +++ b/src/MahApps.Metro/Controls/MetroWindow.cs @@ -84,6 +84,7 @@ public class MetroWindow : Window /// public static readonly DependencyProperty IsCloseButtonEnabledWithDialogProperty = IsCloseButtonEnabledWithDialogPropertyKey.DependencyProperty; + public static readonly DependencyProperty ShowSystemMenuProperty = DependencyProperty.Register("ShowSystemMenu", typeof(bool), typeof(MetroWindow), new PropertyMetadata(true)); public static readonly DependencyProperty ShowSystemMenuOnRightClickProperty = DependencyProperty.Register("ShowSystemMenuOnRightClick", typeof(bool), typeof(MetroWindow), new PropertyMetadata(true)); public static readonly DependencyProperty TitleBarHeightProperty = DependencyProperty.Register("TitleBarHeight", typeof(int), typeof(MetroWindow), new PropertyMetadata(30, TitleBarHeightPropertyChangedCallback)); @@ -549,7 +550,16 @@ public bool IsCloseButtonEnabledWithDialog } /// - /// Gets/sets if the the system menu should popup on right click. + /// Gets or sets a value that indicates whether the system menu should popup with left mouse click on the window icon. + /// + public bool ShowSystemMenu + { + get { return (bool)GetValue(ShowSystemMenuProperty); } + set { SetValue(ShowSystemMenuProperty, value); } + } + + /// + /// Gets or sets a value that indicates whether the system menu should popup with right mouse click if the mouse position is on title bar or on the entire window if it has no title bar (and no title bar height). /// public bool ShowSystemMenuOnRightClick { @@ -1307,7 +1317,7 @@ private void IconMouseDown(object sender, MouseButtonEventArgs e) { Close(); } - else + else if (this.ShowSystemMenu) { ShowSystemMenuPhysicalCoordinates(this, PointToScreen(new Point(0, TitleBarHeight))); }