2011-11-25 77 views
0

我有一個文本塊,應該改變其文本(它必須顯示文本幾秒鐘,然後消失)。不能分配RoutedEvent Binding.TargetUpdated

<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"> 

什麼是錯的代碼?

回答

1

Silverlight支持的唯一支持Triggers屬性的事件是Loaded事件。其他任何情況都會導致此例外情況。

爲了實現這種Xaml事件邏輯,您可以下載Blend SDK,其中包含像這樣的所有方式的有用功能。在你的情況下,你正在尋找PropertyChangedTrigger