开发者

Can I reference Storyboard resources in XAML defind Visual States?

I have six different objects with their own Visual State Managers. The Focused state of each object is the same. I want to define a single Focused State Storyboard resource开发者_如何学C and reference it in each of the 6 Focus Visual states. Can this be done? Here's my code (all in the same UserControl.Resources):

<Storyboard x:Key="FocusedState">
     ...
</Storyboard>

In each of my 6 objects I have the following:

<VisualStateGroup x:Name="FocusStates">
 <VisualState x:Name="Focused" Storyboard="{StaticResource FocusedState}"/>
...

When I run the project I get the following error:

Message: Attribute {StaticResource FocusedState} value is out of range.


It looks like it's not possible to use dynamic resource reference or binding to set Storyboard or Animation values in control templates. I found the answer and explanation on this post.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜