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

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -