【发布时间】:2013-04-22 06:54:58
【问题描述】:
我有VisualStateManager来控制当State发生时,控制是启用的:
这里是状态的属性(字符串):
states:StateManager.VisualStateProperty="{Binding SomeProp}"
这里是VisualStateManager:
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="VisualStateGroup">
<VisualState x:Name="MyName">
<Storyboard>
<BooleanAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.IsEnabled)" Storyboard.TargetName="MyTextBox">
<DiscreteBooleanKeyFrame KeyTime="0" Value="True" />
</BooleanAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="HerName">
<Storyboard>
...
</Storyboard>
</VisualState>
<VisualState x:Name="This">
<Storyboard>
...
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
这是我的文本框:
<TextBox Name="MyTextBox" />
我的问题是:当我将 TextBox 添加到以下行时会发生什么:
IsEnable= {Binding isProp}// isProp = bool
在我看来,它消除了TextBox 的IsEnable 而不是指他,只指State。
这是真的吗?有没有一种方法可以同时工作?
【问题讨论】:
标签: wpf binding visualstatemanager