c# - WPF ContextMenu get parent MenuItem Tag from Child MenuItem -
i new wpf , whole binding model, , have been tasked include context menu has next structure:
-add row below
--list item 1
--list item 2
-add row above
--list item 1
--list item 2
i have following:
<usercontrol.resources> <c:arraylist x:key="submenu" x:shared="false"> <menuitem commandparameter="{binding tag}" command="item1command" header="item1" /> <menuitem commandparameter="{binding tag}" command="item2command" header="item2"/> </c:arraylist> </usercontrol.resources> <grid.contextmenu > <contextmenu opened="menuitem_click" datacontext="{binding path=placementtarget.tag, relativesource={relativesource self}}" > <menuitem header="above" tag="{binding path=abovecommand}" itemssource="{staticresource submenu}" /> <menuitem header="below" tag="{binding belowcommand}" itemssource="{staticresource submenu}" > /> </contextmenu> </grid.contextmenu>
i want larn how pass parent menu item tag kid commandparameter, know if adding item above or below. able through xaml , not in code behind if possible!
c# wpf
No comments:
Post a Comment