WPF Treeview contextmenu IsChecked binding MVVM

Posted by BrettRobi on Stack Overflow See other posts from Stack Overflow or by BrettRobi
Published on 2010-03-27T01:23:08Z Indexed on 2010/03/27 1:33 UTC
Read the original article Hit count: 1468

Filed under:
|
|
|

I've got a TreeView to which I associate a ContextMenu. That contextmenu has an item whose IsChecked property I want to bind to my ViewModel. Since I am using a tree each treeitem is bound to a subproperty of my ViewModel.

In the VS2010 output window I am seeing this databinding error:

BindingExpression path error: 'IsAutoStart' property not found on 'object' ''HostMgmtViewModel' (HashCode=12565727)'. BindingExpression:Path=IsAutoStart; DataItem='HostMgmtViewModel'

This clearly shows it is trying to bind to my ViewModel and not to the treeitem's associated data. How do I bind to the correct object? Remember my contextmenu is associated with the whole TreeView not to the specific treeitem.

© Stack Overflow or respective owner

Related posts about wpf

Related posts about databinding