c# - Filling an entire MenuButton with an Image -
i'm trying create wpf menu consists out of 5 simple buttons filled entire single image. i've created following xaml:
<menu x:name="menumain" height="40" margin="0,0,0,0" verticalalignment="top" horizontalalignment="stretch"> <menuitem x:name="menuitemprint" width="40" height="40"> <menuitem.icon> <image source="resources/images/yes.png" width="40" height="40"/> </menuitem.icon> </menuitem> <menuitem x:name="menuitemclear" width="40" height="40"> <menuitem.icon> <image source="resources/images/yes.png" width="40" height="40"/> </menuitem.icon> </menuitem> <menuitem x:name="menuitemsettings" width="40" height="40"> <menuitem.icon> <image source="resources/images/yes.png" width="40" height="40"/> </menuitem.icon> </menuitem> <menuitem x:name="menuitemscanner" width="40" height="40"> <menuitem.icon> <image source="resources/images/yes.png" width="40" height="40"/> </menuitem.icon> </menuitem> <menuitem x:name="menuitemmode" width="40" height="40" click="menuitemmode_click"> <menuitem.icon> <image source="resources/images/yes.png" width="40" height="40"/> </menuitem.icon> </menuitem> </menu>
but exact result of shown below:
it's showing top left quarter of image, , seems offsetting bizarre reason well? answers on internet involve setting size of picture, did (the .png size 40x40, , menuitems , images.
i've tried changing alignment, setting fill 'stretch' , adjusting margin, nothing seems help.
for record, i'm trying achieve shown below (though preferably less grotesquely ugly green checkmark. you'll have excuse editing skills).
instead of using icon
attribute, use header
, set margin
offset.
<menuitem x:name="menuitemprint" width="40" height="40"> <menuitem.header> <image source="resources/images/yes.png" width="40" height="40" margin="-7"/> </menuitem.header> </menuitem>
Comments
Post a Comment