Search This Blog

Thursday, December 1, 2011

Silverlight xaml style add image

I will cover adding images with the example of ToggleButton. To add an image to a Silverlight style just do the following:

<ToggleButton>
    <Image Source="/Some.Company.Namespace.ModuleName;component/Styles/Images/image.png" Width="10" Height="10" />
</ToggleButton>

Where Some.Company.Namespace.ModuleName is the assembly name (project properties->Assembly name). This is followed by ‘component’ which denotes project folder. Then we have folder path and image file name.

So the path is:

AssemblyName;component/PathToTheImage

No comments:

Post a Comment

If you like this post, please leave a comment :)