Specify Command for MenuItem in a DataTemplate

后端 未结 3 473
花落未央
花落未央 2020-12-09 16:49

I have a context menu. It\'s bound to some collection and it has a defined ItemTemplate like this:



        
3条回答
  •  渐次进展
    2020-12-09 17:45

    I think you need to wrap your TextBlock in a MenuItem:

    
        
            
        
    
    

    But I don't have an IDE in front of me right now to try this. Let me know how it goes.


    Looks like you need to use the ItemContainerStyle as seen here. Sorry for leading you down the wrong path at the start there - but I got in front of an IDE and this works:

    
        
    
    

提交回复
热议问题