Please tell me how Can I solve my problem. The situatino is as follow: I had a list box with image inside it, I would like some of the image to blinking, some not. I had the property "Emergeny" if it is true the image should blink, now the question is how can I bind it. I try to Bind to "Duartion" or "To" propperty but I receives an error. The code below is my image which is blinking.
<Image Height="32" Width="32" Source="{Binding Emergency, Converter={StaticResource boolToPath}}">
<Image.Style>
<Style>
<Style.Triggers>
<EventTrigger RoutedEvent="Image.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="(Image.Opacity)" BeginTime="0:0:0" Duration="0:0:0.5"
From="1.0" To="0.0" RepeatBehavior="Forever开发者_运维技巧" AutoReverse="True" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Style.Triggers>
</Style>
</Image.Style>
</Image>
Instead of triggering on Event.Loaded
, trigger on your property:
<Trigger Property="IsEmergency" Value="True">
<BeginStoryboard .../>
</Trigger>
精彩评论