c# - wpf mvvm treeview contexmenu -
i'm learning wpf/mvvm , got stuck on following... code below working
<listbox x:name="listbox" dockpanel.dock="top" itemssource="{binding items}" displaymemberpath="name" > <listbox.contextmenu> <contextmenu datacontext="{binding path=placementtarget, relativesource={relativesource self}}"> <menuitem header="show selected" command="{binding path=datacontext.showselectedcommand}" commandparameter="{binding path=selecteditems}"/> </contextmenu> </listbox.contextmenu> </listbox>
but when i've replaced listbox on treeview, such
<treeview x:name="tview" dockpanel.dock="top" displaymemberpath="name" tag="{binding datacontext, relativesource={relativesource self}}" itemssource="{binding items}" > <treeview.contextmenu> <contextmenu datacontext="{binding placementtarget.tag, relativesource={relativesource self}}" staysopen="true"> <menuitem header="show selected" command="{binding datacontext.showselectedcommand}" commandparameter="{binding path=selecteditems}"> </menuitem> </contextmenu> </treeview.contextmenu> </treeview>
the showselectedcommand doesn't invoked. please explain what's wrong there , how can make work. lot.
Comments
Post a Comment