We've made a ControlTemplate that defines a rounded border and some animation on mouseover that is default for our buttons, them we put a ContentPresenter inside this Button, on a layer above that default background so we can change the content of the
button depending on where we`re using it.
Them, we created a Style (DefaultButtonStyle) that would set the template to our template.
And finally, for each diferent button we created a Style (BasedOn the DefaultButtonStyle) that would set a ToolTip and the Content, the Content is a Rectangle with the fill property set using DynamicResource to a DrawingBrush with the image we want
for that button.
Now, a ListBox uses a DataTemplate that has a button with one of the styles we`ve defined earlier. (Some like a print button for each row on the table).
The big problem is: When we run the program it only shows the image on the last line of the ListBox, all the other lines show the buttons without the Rectangle. Trying to see if we could reproduce the error we`ve noticed that even if its not
on a ListBox, if we open 2 instances of the same screen, the button would not show.
Is there any limitations on using styles and templates for this? It only bug the Content we added on the Styles with BasedOn the DefaultButtonStyle, the other properties like animations and background (defined in the defaul
View Complete Post