C# 如何在wpf c中禁用devexpress主题窗口的上下文菜单#

C# 如何在wpf c中禁用devexpress主题窗口的上下文菜单#,c#,wpf,window,devexpress,C#,Wpf,Window,Devexpress,当我使用mouserightbutton单击标题栏时,我试图禁用DevXPress主题窗口的弹出上下文菜单 我使用了下面的代码,它在“窗口”中工作,但“主题窗口”不工作: public MainWindow() { InitializeComponent(); Loaded += MainWindow_Loaded; } private void MainWindow_Loaded(object sender, RoutedEventArgs e) { IntPtr w

当我使用mouserightbutton单击标题栏时,我试图禁用DevXPress主题窗口的弹出上下文菜单

我使用了下面的代码,它在“窗口”中工作,但“主题窗口”不工作:

public MainWindow()
{
    InitializeComponent();
    Loaded += MainWindow_Loaded;
}

private void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
    IntPtr windowHandle = new WindowInteropHelper(this).Handle;
    HwndSource hwndSource = HwndSource.FromHwnd(windowHandle);
    hwndSource.AddHook(new HwndSourceHook(WndProc));
}

private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
    if (msg == 0xa4)
    {
        handled = true;
    }
    return IntPtr.Zero;
}

如果我想在主题窗口中执行相同的操作,我应该怎么做?

我在下面的url中找到了解决方案: