c# - Size MenuItem to fit contents in XAML -
i hoping find way remove space on left in popup (sub) 'menuitem's , have them take space required without having make whole new template control. there sort of dependency property or of nature use in situation? i've tried creating new templates , i'm trying accomplish it's cumbersome , seems overkill.
if has suggestions (especially on how rid of pesky box on left of 'menuitem' without making new template) please let me know. appreciated.
there trick. see if solve purpose set itemspanel in style , add in resource
<style targettype="{x:type menuitem}"> <setter property="itemspanel"> <setter.value> <itemspaneltemplate> <stackpanel margin="-20,0,0,0" background="gray"></stackpanel> </itemspaneltemplate> </setter.value> </setter> </style> <menu> <menuitem header="mi1"> <menuitem header="mi1"></menuitem> <menuitem header="mi2"></menuitem> </menuitem> <menuitem header="mi2"></menuitem> </menu>
Comments
Post a Comment