WPF Style Triggers in DataTemplate?

The problem is that if you create an Image in a style there is only one instance, so as soon as multiple controls use the style there is going to be a fight over this one instance which can only be owned by one control.

The problem is that if you create an Image in a style there is only one instance, so as soon as multiple controls use the style there is going to be a fight over this one instance which can only be owned by one control. The easiest solution to this is placing the Style in a resource and setting x:Shared to false, that way a copy of the style is used whereever referenced.

Hm, sounds reasonable. Just why did the Exception also occur when I switched from the Template WITH buttons to one WITHOUT? – gelse Aug 23 at 13:53 @gelse: Maybe that causes the trigger to fire, which leads to the conflict again.

This may happen before the template is actually changed. – H.B. Aug 23 at 14:38.

That does not change anything. Same error. Honestly, I don't know any more why I did use the BitmapImages.

I think it was because initially I wanted the ImageSource to be bindable. So I had to choose between either a ImageSource object on the model or the String to the URI and load it with the BitmapImages. That also means that the images are loaded only once into memory.

I am not sure if that is the case if you use the URI. – gelse Aug 22 at 12:06 ah - and right now I am pretty sure that the problem is because the framework tries to set the TRIGGER twice. I have no idea if that is possible and why it raises an error, but it seems the best explanation to me.

– gelse Aug 22 at 12:11.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions