如何在WPF应用程序中停止右键单击Ttitle栏



在C#中使用WPF(带MahApps)编写程序,想知道如何禁用用户右键单击标题栏并显示窗口选项菜单?

编辑1:为了确认我想保留栏上的最小/最大/关闭按钮,只需删除右键点击事件

在MahApps v2.x中有一个名为ShowSystemMenuOnRightClick的新属性。

<mah:MetroWindow x:Class="MetroDemo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="MahApps.Metro - Demo Application"
Width="900"
Height="600"
mah:DialogParticipation.Register="{Binding}"
GlowBrush="{DynamicResource MahApps.Brushes.Accent}"
ShowIconOnTitleBar="True"
ShowSystemMenuOnRightClick="False"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
</mah:MetroWindow>

最新更新