c# - Menuitem gets clicked but who is the parent? -


i'm new c# , wpf can not clever question. i've spent time far , not prepared face following.

my code build menu based on data tables. creates menu 2 levels deep. , event handler triggered each time main or sub item selected. trouble should know main item (parent) when sub item (child) clicked. how gain that? current handler:

    private void menu_click(object sender, routedeventargs e)     {         string sub = "";         sub = ((system.windows.controls.headereditemscontrol)(e.source)).header.tostring();         messagebox.show("selection: " + sub, "info", messageboxbutton.ok);     } 

i saw item.tag solution couldn't find way.

the headereditemscontrol has parent property. can used retrieve element, menu item child of.


Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -