Click here to Skip to main content
15,886,661 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my ResourceDictionary I have this statement:

XML
<Style TargetType="MenuItem">
    <Style.Triggers>
        <Trigger Property="Header" Value="Close">
            <Setter Property="Icon" Value="WHAT TO PUT HERE???"/>
        </Trigger>
    </Style.Triggers>
</Style>



How can I set the icon?
My icons are all in a folder.
Posted
Comments
[no name] 28-Sep-14 10:20am    
Well that would be where you put the image source for your image.

1 solution

Hi,

You have to put the position of your image relative to your file location in the project

1 Add your image
2 Write the image uri as Folder/file

For example. Let's say you have an image test.jpg.

Add it to your project in the folder Resources and, in the main folder, there is your ResourceDictionary. So, in your marked line, write "Resources/test.jpg".

If you cannot find any relative position because your dictionary is in a different folder respectively to your image, use the uri pack syntax

pack://application:,,,/Resources/test.jpg

Hope this helped.

LG
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900