WPF menu resource usage

I have a ContextMenu resource that needs to be used in three UserControls. It looks like this:

	<ContextMenu x:Key="mnuOverride">
		<MenuItem Header="Show as bits" IsCheckable="True" Name="mnuShowAsBits" />
		<MenuItem Header="Hide Peripheral" Name="mnuHidePeripheral" />
		<Separator />
		<MenuItem Header="View Hidden Peripherals" Name="mnuViewHiddenPeripherals"  />
	</ContextMenu>

Open in new window


One of the menu items needs to be handled in two of the controls and the other two in the third control. How can I do this?

Thanks,
Sid.
Sid PriceSoftware Systems Architect/DesignerAsked:
Who is Participating?
 
CodeCruiserConnect With a Mentor Commented:
One option is to define different context menus in each user control.
0
 
Sid PriceSoftware Systems Architect/DesignerAuthor Commented:
Yes that is an option, however I was hoping to not have multiple, duplicated, resources. From my research that may be the only option.
Thanks,
Sid.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.