我有一个文本块,它应该对更改文本做出反应(它必须显示文本几秒钟,然后消失)。
<TextBlock Text="{Binding Path=OperationMessage, NotifyOnValidationError=True}" x:Name="label_OperationMessage" Visibility="Collapsed" HorizontalAlignment="Right" Margin="3,3,3,3" >
<TextBlock.Triggers>
<EventTrigger RoutedEvent="Binding.TargetUpdated">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" Duration="0:0:0" To="1.0" />
<DoubleAnimation Storyboard.TargetProperty="Opacity" Duration="0:0:2" From="1.0" To="0.0" BeginTime="0:0:5" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</TextBlock.Triggers>
</TextBlock>当我启动我的应用程序时,我得到了错误:
Failed to assign to property 'System.Windows.EventTrigger.RoutedEvent'. 在线路上
<EventTrigger RoutedEvent="Binding.TargetUpdated">这段代码有什么问题?
发布于 2011-11-26 04:58:22
Silverlight支持在Triggers属性中使用的唯一事件是Loaded事件。任何其他操作都将导致此异常。
要获得这种Xaml事件逻辑,您可以下载Blend SDK,其中包含各种有用的特性。在您的示例中,您正在寻找PropertyChangedTrigger。
https://stackoverflow.com/questions/8269265
复制相似问题