batGnat
batGnat

Reputation: 1

WPF Dynamic Icon Wierdness

I have an WPF application that has a dynamic icon. Three emoji icons depending on apps state (Happy, Sad, Thinking). I have a Binding on the Icon, with a ValueConvertor doing the work and it works great.

Or so I thought.

It is almost like the it cant find the resource; example: icon = @"pack://application:,,,/Media/emojiSad.ico" because it is being run from the desktop.

Upvotes: 0

Views: 947

Answers (2)

tendai
tendai

Reputation: 1251

Is your icon's build action property set to 'Resource'?

Nomatter where you deploy your project from, it should almost always pick up your image if its Build Action is set to 'Resource'

Upvotes: 1

user3583535
user3583535

Reputation: 250

How are you trying to reference the icons? I have always had no issue by setting them as embedded resources and referencing them as demonstrated at the following link.

Images in WPF as embedded resources

Your converter could return a specific image as follows:

 return new Bitmap(@"images\emojiSad.ico");

Upvotes: 0

Related Questions