WPF MenuItem ViewModel Command
Posted
by Jon Archway
on Stack Overflow
See other posts from Stack Overflow
or by Jon Archway
Published on 2010-04-30T12:39:28Z
Indexed on
2010/04/30
12:57 UTC
Read the original article
Hit count: 651
Hi,
I am fairly new to WPF and am struggling a little with a scenario. I have a menu which has menu items. When one of these menu items gets clicked a method needs to be called that will do something based upon the text displayed associated with that menu item. So for example, the menu item's content was "test" so I would need to do something with "test". FYI, this "something" directly affects a collection on the ViewModel.
This is easy to achieve using the click event and no ViewModel, but I was trying to implement MVVM using an explicit ViewModel. So I started to look into Commands but cannot see how I would pass anything from the View back into the Command in the ViewModel.
Any suggestions on what I should be doing here?
Thanks
© Stack Overflow or respective owner