How to show drawing brush as a Menu item Icon

Justin CI

I need to show drawing brush as MenuItem icon.

Following is the drawing brush

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <DrawingBrush x:Key="NewDocument" Stretch="Uniform">
        <DrawingBrush.Drawing>
            <DrawingGroup>
                <DrawingGroup.Children>
                    <GeometryDrawing Brush="#FF000000" Geometry="F1 M 41.3333,41.3333L 0,41.3333L 0,0L 41.3333,0L 41.3333,41.3333 Z "/>
                    <GeometryDrawing Brush="#FFEFAE5A" Geometry="F1 M 15.8164,7.40293L 15.8164,1.85626L 13.9991,1.85626L 13.9991,7.40293C 14.2964,7.35093 14.5951,7.31093 14.9071,7.31093C 15.2191,7.31093 15.5177,7.35093 15.8164,7.40293 Z "/>
                    <GeometryDrawing Brush="#FFEFAE5A" Geometry="F1 M 21.1491,3.7708L 19.5731,2.86147L 16.7997,7.6668C 17.3784,7.88413 17.9024,8.19614 18.3704,8.5828L 21.1491,3.7708 Z "/>
                    <GeometryDrawing Brush="#FFEFAE5A" Geometry="F1 M 24.8099,8.09827L 23.9005,6.52493L 19.0885,9.30227C 19.4765,9.76893 19.7899,10.2929 20.0045,10.8756L 24.8099,8.09827 Z "/>
                    <GeometryDrawing Brush="#FFEFAE5A" Geometry="F1 M 8.66667,21.7579L 10.2413,22.6672L 13.0147,17.8619C 12.436,17.6472 11.912,17.3352 11.444,16.9459L 8.66667,21.7579 Z "/>
                    <GeometryDrawing Brush="#FFEFAE5A" Geometry="F1 M 5.00454,17.4343L 5.91387,19.0076L 10.7272,16.2289C 10.3392,15.7623 10.0259,15.2396 9.8112,14.6596L 5.00454,17.4343 Z "/>
                    <GeometryDrawing Brush="#FFEFAE5A" Geometry="F1 M 9.54493,11.8561L 3.9996,11.8561L 3.9996,13.6735L 9.54493,13.6735C 9.49559,13.3788 9.45426,13.0748 9.45426,12.7655C 9.45426,12.4548 9.49559,12.1521 9.54493,11.8561 Z "/>
                    <GeometryDrawing Brush="#FFEFAE5A" Geometry="F1 M 5.914,6.52533L 5.00467,8.09866L 9.81,10.8747C 10.0247,10.2933 10.338,9.76934 10.726,9.30266L 5.914,6.52533 Z "/>
                    <GeometryDrawing Brush="#FFEFAE5A" Geometry="F1 M 10.2409,2.86134L 8.66627,3.77067L 11.4449,8.584C 11.9116,8.196 12.4356,7.884 13.0156,7.66666L 10.2409,2.86134 Z "/>
                    <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 25.3333,25.3333L 25.3333,14.6667L 17.3333,14.6667L 17.3333,38.6667L 36,38.6667L 36,25.3333L 25.3333,25.3333 Z "/>
                    <GeometryDrawing Brush="#FFFFFFFF" Geometry="F1 M 28,14.6667L 28,22.6667L 36,22.6667L 28,14.6667 Z "/>
                </DrawingGroup.Children>
            </DrawingGroup>
        </DrawingBrush.Drawing>
    </DrawingBrush>
</ResourceDictionary>

I need to show it as a Menu Item Icon.

I tried the followinng way

 <MenuItem 
                      Header="New" Command="{Binding New}" >
                <MenuItem.Icon >
                    <Image Source="Resources/Icons/NewDocument.xaml"/>
                </MenuItem.Icon>
            </MenuItem>

looking for a solution .Please help.

Ramankingdom
            <MenuItem.Icon>
                <Rectangle Fill="{StaticResource NewDocument}" Stretch="Uniform" >
                </Rectangle>
            </MenuItem.Icon>

This will work

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How does this strange condition happens when show menu item icon in toolbar overflow menu?

From Dev

How to change Menu Item icon from fragment?

From Dev

How to display menu item with icon and text in AppCompatActivity

From Dev

How to change the size of menu item icon in NavigationView?

From Dev

How to show @item value with its own icon

From Dev

Android menu item with icon

From Dev

How to show a new screen from menu item

From Dev

Windows 7: How to change context menu item icon?

From Dev

How to place checkbox icon to left of text in checkable menu item in android?

From Dev

Show chosen menu item

From Dev

Show click menu item

From Dev

how can i show android:icon in android menu ( android studio)

From Dev

How to show list of icon with text in android action menu like image

From Dev

How to force Ionic to show only menu icon on every page?

From Dev

How do I show menu list below hamburger icon?

From Dev

How not to show Universal Access menu Icon in task bar in Ubuntu 18.04?

From Dev

Service changes the icon of a menu item

From Dev

Icon for menu item from layout

From Dev

How to show selected item with icon in a list to user-ionic3

From Dev

Icon of the menu item doesn't show up in the Action Bar if it is from app drawable folders

From Dev

How convert Drawing.Color to Drawing.Brush, Windows Forms

From Dev

How to show border around text in android action bar menu item?

From Dev

How to don't show menu item in Action Overflow?

From Dev

how to show an arrow to the only li item that has sub-menu

From Dev

How to show border around text in android action bar menu item?

From Dev

How create an icon menu?

From Dev

Dose not show menu drawer item

From Dev

get drawable from Android Menu Item Icon

From Dev

Break line after Icon in Menu Item Android

Related Related

  1. 1

    How does this strange condition happens when show menu item icon in toolbar overflow menu?

  2. 2

    How to change Menu Item icon from fragment?

  3. 3

    How to display menu item with icon and text in AppCompatActivity

  4. 4

    How to change the size of menu item icon in NavigationView?

  5. 5

    How to show @item value with its own icon

  6. 6

    Android menu item with icon

  7. 7

    How to show a new screen from menu item

  8. 8

    Windows 7: How to change context menu item icon?

  9. 9

    How to place checkbox icon to left of text in checkable menu item in android?

  10. 10

    Show chosen menu item

  11. 11

    Show click menu item

  12. 12

    how can i show android:icon in android menu ( android studio)

  13. 13

    How to show list of icon with text in android action menu like image

  14. 14

    How to force Ionic to show only menu icon on every page?

  15. 15

    How do I show menu list below hamburger icon?

  16. 16

    How not to show Universal Access menu Icon in task bar in Ubuntu 18.04?

  17. 17

    Service changes the icon of a menu item

  18. 18

    Icon for menu item from layout

  19. 19

    How to show selected item with icon in a list to user-ionic3

  20. 20

    Icon of the menu item doesn't show up in the Action Bar if it is from app drawable folders

  21. 21

    How convert Drawing.Color to Drawing.Brush, Windows Forms

  22. 22

    How to show border around text in android action bar menu item?

  23. 23

    How to don't show menu item in Action Overflow?

  24. 24

    how to show an arrow to the only li item that has sub-menu

  25. 25

    How to show border around text in android action bar menu item?

  26. 26

    How create an icon menu?

  27. 27

    Dose not show menu drawer item

  28. 28

    get drawable from Android Menu Item Icon

  29. 29

    Break line after Icon in Menu Item Android

HotTag

Archive