Closed ghost closed 4 years ago
I looked at other applications that have additional buttons in their title bar like MS Word and Google Chrome and it seems they behave just like AdonisUI by opening the system context menu as well.
But if you still want to suppress the context menu in your application you could attach an event handler to the MouseRightButtonUp
event of the button and declare the event to be handled.
In your window xaml:
<adonisControls:AdonisWindow.TitleBarContent>
<Button Style="{DynamicResource {x:Static adonisUi:Styles.WindowButton}}"
MouseRightButtonUp="TitleBarButton_OnMouseRightButtonUp"/>
</adonisControls:AdonisWindow.TitleBarContent>
In code-behind:
private void TitleBarButton_OnMouseRightButtonUp(object sender, MouseButtonEventArgs e)
{
e.Handled = true;
}
Hope this helps.
Closing this because no further feedback was given for a while. Please reopen in case the suggested solution does not work for you or does not answer your question.
Thank you very much for recording my question and giving me a reply. Your suggestion is very effective for me. Thank you at last.
From LungMaang Sent to Mr. Benjamin Rühl 发件人: Benjamin Rühlmailto:notifications@github.com 发送时间: 2019年12月30日 1:38 收件人: benruehl/adonis-uimailto:adonis-ui@noreply.github.com 抄送: LungMaangmailto:LungMaang@outLook.com; Authormailto:author@noreply.github.com 主题: Re: [benruehl/adonis-ui] How do I disable the system menu from the custom buttons at the top of the form? (#47)
I looked at other applications that have additional buttons in their title bar like MS Word and Google Chrome and it seems they behave just like AdonisUI by opening the system context menu as well.
But if you still want to suppress the context menu in your application you could attach an event handler to the MouseRightButtonUp event of the button and declare the event to be handled.
In your window xaml:
Form at the top of the default button will not display system when the mouse right click on the menu, but when I was at the top of the other custom button can't stop it, according to the set WindowChrome. IsHitTestVisibleInChrome no effect, whether there are other ways to solve?