wpf - Context menu should appear only on TreeView child nodes -


i have treeview contextmenu on treeviewitems. when right click on treeviewitems, contextmenu appears quite nicely. dont want contextmenu appear on parent items. should appear on child nodes. have 1 hirarchy in treeview i.e. n parents have m children on same level. xaml treeview , contextmenu

   <treeview margin="2,0,0,0"  itemssource="{binding sourcedata}" width="390">         <treeview.itemcontainerstyle >             <style targettype="{x:type treeviewitem}">                   <setter property="isselected" value="{binding datacontext.isselected, mode=twoway,  relativesource={relativesource self}}" />                       <setter property="contextmenu">                                 <setter.value>                                     <contextmenu name="contextmenu" datacontext="{binding placementtarget.datacontext, relativesource={relativesource self}}" >                                         <menuitem name="menuitem" header="rename" command="{binding renamecommand}" />                                     </contextmenu>                      </setter.value>                 </setter>                 <style.triggers>                         <trigger property="isselected" value="true">                          </trigger>                 </style.triggers>                         </style>    </treeview.itemcontainerstyle > 


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -