c# - WPF Ribbon ApplicationMenu open and close event -
i'm using wpf ribbon application menu:
https://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=11877
https://msdn.microsoft.com/de-de/library/ff799534(v=vs.110).aspx
how can close application (file) menu programmatically?
how can detect if user opens application menu? didn't found appropriated event
you need isdropdownopen
property , related event(s). xaml (this .net 4.5+, 4.0 same, difference in namespace prefix):
<stackpanel> <ribbon> <ribbon.applicationmenu> <ribbonapplicationmenu x:name="menu" dropdownopened="ribbonapplicationmenu_dropdownopened"> <ribbonapplicationmenuitem header="foo"/> <ribbonapplicationmenuitem header="bar"/> </ribbonapplicationmenu> </ribbon.applicationmenu> </ribbon> </stackpanel>
code-behind:
public partial class mainwindow : window { public mainwindow() { initializecomponent(); } private void ribbonapplicationmenu_dropdownopened(object sender, eventargs e) { // user has opened menu debug.writeline("menu opened."); // let's close code menu.isdropdownopen = false; } }
also, may want disable entire menu. can done using isenabled
property.
Comments
Post a Comment