为什么我的 DataStateBehavior 不起作用
DataStateBehavior 不起作用。当属性嵌套时,有什么技巧可以让它工作吗?
<i:Interaction.Behaviors>
<ic:DataStateBehavior x:Name="DataStateBehaviorCustomIndexButton" Binding="{Binding ViewModel.ButtonVisibleFlag, Mode=TwoWay}" TrueState="ButtonVisible" FalseState="ButtonHidden"/>
</i:Interaction.Behaviors>
DataStateBehavior isn't working. Is there a trick to make it work when properties are nested?
<i:Interaction.Behaviors>
<ic:DataStateBehavior x:Name="DataStateBehaviorCustomIndexButton" Binding="{Binding ViewModel.ButtonVisibleFlag, Mode=TwoWay}" TrueState="ButtonVisible" FalseState="ButtonHidden"/>
</i:Interaction.Behaviors>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
DataStateBehavior 允许您将数据绑定值与预期值进行比较,如果相等则进入一种状态,如果不相等则进入另一种状态。
因此,如果我们想要在属性“Count”的绑定为 5 时进入名为“CountIs5”的状态,则看起来像:
我认为理解中缺少的是“Value”属性。
注意:值也可以是数据绑定的。
The DataStateBehavior allows you to compare a data-bound value with an expected value and go to one state if they are equal, and another state if they aren't.
So if we want to go to a state called "CountIs5" whenever our binding of the property "Count" is 5, it looks like:
I think what is missing in understanding is the "Value" attribute.
Note: Value can be data-bound as well.
事实证明我不明白价值是什么。
我以为它是初始值,但实际上它是触发 true/false 的值。
As it turns out I didn't understand what value does.
I thought it was initial value, but instead it was the value that triggers a true/false.