DelegateCommand is not invoked in context menu

前端 未结 3 872
感动是毒
感动是毒 2021-01-25 11:13

I can`t seem to get this right click popup menu to work.



        
3条回答
  •  花落未央
    2021-01-25 11:35

    Since learning more and more about C# and WPF if anyone else is looking for an answer regarding this. the answer is simple.

    Your going about it the wrong way. If you need to use a "Behaviour" over and over again and your using either a MVVM style code (or you think you are because its probably not quite there yet) You need to use what they call an Attached Property.

    Simply Put.

    1. Create an attached property class. http://dotnetbyexample.blogspot.com.au/2010/05/attached-dependency-properties-for.html should get you started
    2. Create a template to your Menu Items Example Below
    3. Create Standard Menu Items.
    4. Handle Everything in your Attached Property PropertyMetadata Event Handler.

       
      

提交回复
热议问题