C# 如何在WPF应用程序中停止右键单击TtitleBar

C# 如何在WPF应用程序中停止右键单击TtitleBar,c#,wpf,mahapps.metro,C#,Wpf,Mahapps.metro,在C#中使用WPF(带MahApps)编写程序,并想知道如何禁用用户右键单击标题栏并弹出窗口选项菜单 Edit1:要确认是否保留工具栏上的“最小/最大/关闭”按钮,只需删除右键单击事件MahApps v2.x中有一个名为ShowSystemMenuOnRightClick的新属性 <mah:MetroWindow x:Class="MetroDemo.MainWindow" xmlns="http://schemas.micr

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


Edit1:要确认是否保留工具栏上的“最小/最大/关闭”按钮,只需删除右键单击事件

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>


这个问题有一个答案。这个链接答案的问题是它也删除了控制框(最小/最大/关闭)。基于这个问题,我认为这不是我想要的行为。正确的我想保留最小/最大/关闭按钮只需删除右键单击事件正是我想要的谢谢,工作完美!