Claus Jørgensen
Claus Jørgensen

Reputation: 26347

Separate VisualStateManager.VisualStateGroups to a resource dictionary

Is there any way to separate the VisualStateManager.VisualStateGroups into a ResourceDictionary ?

Basically I want something like

<VisualStateManager.VisualStateGroups x:Name="MyVisualGroups">
    <VisualStateGroup x:Name="A" />
    <VisualStateGroup x:Name="B" />
    <VisualStateGroup x:Name="C" />
</VisualStateManager.VisualStateGroups>

but it obviously doesn't work. Any way to make it work?

Upvotes: 5

Views: 1694

Answers (1)

ZombieSheep
ZombieSheep

Reputation: 29953

If you wrap them in a style objct, you should be able to make this work. Check out my answer to this question for an example of how the VSM stuff is wrapped to restyle the selected state in a listbox.

Note : I am not sure if that would work for a set of generic VisualStates, though. It does work for the whole of a listbox ItemContainerStyle settings, though.

Upvotes: 3

Related Questions