我試圖旋轉TextBlock 360度,只要它是綁定更新。如何使WPF TextBlock在其值更新時旋轉?
從我讀過的所有東西都應該可以工作,但是它沒有任何效果。我究竟做錯了什麼?
<TextBlock VerticalAlignment="Center" Text="{Binding Total, NotifyOnTargetUpdated=True}">
<TextBlock.RenderTransform>
<RotateTransform x:Name="TotalSpinTransform" Angle="0"/>
</TextBlock.RenderTransform>
<TextBlock.Triggers>
<EventTrigger RoutedEvent="Binding.TargetUpdated">
<EventTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="(TextBlock.RenderTransform).(RotateTransform.Angle)"
From="0" To="360" Duration="0:0:0.2" AutoReverse="True"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger.EnterActions>
</EventTrigger>
</TextBlock.Triggers>
</TextBlock>
你在運行時在輸出窗口中看到警告嗎? – RQDQ 2011-03-04 18:05:59