xaml - How do I make custom MenuHeaders in WPF with accelerators? -
i'd make custom menuheaders in wpf can have (for example), icon , text in menu item.
normally using menuitems, if populate header field straight text, can add accelerator using underscore. eg, _file
however, if wanted put in usercontrol, believe function break, how similar following?
<menu> <menuitem> <menuitem.header> <usercontrol> <image source="..." /> <label text="_open" /> </usercontrol> </menuitem.header> </menuitem> ...
i think icon property fits needs.
answer original question, possible retain accelerator functionality when compose content of menuitem. if have nested content in menuitem need define accesstext property explicitly in first 1 below. when use inline form, automagically taken care of.
<menu> <menuitem> <menuitem.header> <stackpanel orientation="horizontal"> <image source="images/open.ico" /> <accesstext>_open..</accesstext> </stackpanel> </menuitem.header> </menuitem> <menuitem header="_close" /> </menu>
Comments
Post a Comment