When I set a style trigger on the children (GroupBoxes) of an ItemsControl the style I've previously applied to GroupBoxes is lost and it renders with default style.
Asked
Active
Viewed 268 times
1 Answers
2
Use the BasedOn property in the new style
This is for using the default style
<Style x:Key="newGroupBoxStyle" TargetType="{x:Type GroupBox}" BasedOn="{StaticResource {x:Type GroupBox}}">
//...put triggers or whatever you want here
</Style>
If you want to use a style based on your own style use
... BasedOn="{StaticResource MyGroupBoxStyleKey} ...

Miklós Balogh
- 2,164
- 2
- 19
- 26
-
Nice. But is there a way to do it without referencing a style key? My style just targets GroupBox and does not have a key. – user13070 Jun 28 '12 at 12:45
-
Oh you edited your answer and i didn't notice the change second time round! thank you very much – user13070 Jun 28 '12 at 12:51