Click here to Skip to main content
15,902,938 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi,
I am trying to create TreeView, which I fill with HierarchicalDataTemplate.
The items in the TreeView (or actually the databinded hierarchical object) has the property called IsCreated.

I would like to create a different ContextMenu for items with different value of IsCreated. I spent whole day on this, no progress. I tried to create these menus in converter and return them to the ContextMenu property in XAML, it worked, but there is no chance to implement any MenuItem events, because the menus instantized in converter do not see the methods in MainWindow class.
Posted

I solved this problem by creating a single context menu, and showing or hiding its items as applicable depending on the context.
 
Share this answer
 
Comments
Alois Holub 19-Jan-11 12:36pm    
Thanks very much, this should work!
fjdiewornncalwe 19-Jan-11 14:23pm    
+5. That is a good solution that still maintains much of the built-in expected behavior of controls relating to context menus.
HI
Can u pls give sample code?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900