Reputation: 9610
I'm using Microsoft's new WPF ribbon (October 2010 release) and I designed my application menu with a RibbonApplicationSplitMenuItem
. If the user clicks on the RibbonApplicationSplitMenuItem
, I want to open the program settings dialog. The subitems contain direct links to the various tab pages in the settings dialog and I want to open the settings dialog with the chosen page selected.
<ribbon:RibbonApplicationSplitMenuItem
Header="Settings"
x:Name="SettingsItem"
Click="settingsClicked"
>
<ribbon:RibbonApplicationMenuItem
Header="Scanner Settings"
x:Name="scannerSettingsItem"
Click="scannerSettingsClicked"
/>
<ribbon:RibbonApplicationMenuItem
Header="Printer Settings"
x:Name="printerSettingsItem"
Click="printerSettingsClicked"
/>
</ribbon:RibbonApplicationSplitMenuItem>
My problem is that when the user clicks on eg. the "Scanner Settings" subitem, first the scannerSettingsClicked()
callback is executed and then the settingsClicked()
callback, causing the settings dialog to be shown a second time right after it has been closed.
The properties windows in Visual Studio's WPF designer also refuses to show the callback subscriptions unless remove either the parent item's callback or that of all the subitems, so I guess I must be doing something wrong.
How can I achieve the desired behavior?
Upvotes: 0
Views: 1391
Reputation: 902
In your subitem click events, set e.Handled = true
to keep the event from bubbling back up to the parent item.
Upvotes: 1