Jason
Jason

Reputation: 85

Changing an Image for an XAML Element

I'm trying to change an image for my XAML element but can't figure out how, I'm using a sand ribbon button from http://www.divelements.co.uk/net/controls/sandribbonsl/ Any idea how I would do this?

XAML Code:

<sr:Button x:Name="Print" Text="Print" SmallImage="/Fsc.Feenics.Clients.Silverlight2;component/Images/16/print.png" Size="Small" Activate="Button_Activate" />

(broken)C# code:

Print.SmallImage = new BitmapImage(new Uri("/Fsc.Feenics.Clients.Silverlight2;component/Images/16/printOn.png"));

Thanks,
Jason

Upvotes: 0

Views: 106

Answers (1)

Jason
Jason

Reputation: 85

Adding UriKind.RelativeOrAbsolute to the following line worked:

Print.SmallImage = new BitmapImage(
    new Uri("/Fsc.Feenics.Clients.Silverlight2;component/Images/16/printOn.png",
            UriKind.RelativeOrAbsolute));

Upvotes: 1

Related Questions