<TextBlock x:Name="xDen" Text="Wrong">
<TextBlock.Triggers>
<EventTrigger RoutedEvent="TextBlock.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="xDen" Storyboard.TargetProperty="Opacity" From="0" To="1" Duration="0:0:0:2" AutoReverse="True" RepeatBehavior="Forever"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</TextBlock.Triggers>
</TextBlock>
Hello, it's my code block and I have code a special code block like, I explained in code block,
private void Check_Click(object sender, RoutedEventArgs e)
{
if(engEdu.Text != "")
{
int indexen = wordEngs.FindIndex(a => a.Contains(engEdu.Text));
if(checkPoint.Text == wordEsps[indexen])
{
espEdu.Text = wordEsps[indexen];
}
else
{
MessageBox.Show("Wrong!");
**I want to work that animation here!**
}
}
}
what should I do for solving this problem?
I tried to do like that,
private void ex()
{
// I Tried to route 'ex' and work it but I couldn't
}
You have many possibilities. You can use
EventTriggerorDataTriggerfor instance.The following example defines two custom routed events:
ValidationFailedto trigger the error animation andValidationPassedto stop it:MainWindow.xaml
MainWindow.xaml.cs