v1rtyaluk Цитата: как ее прикрутить к кнопке??
т.е. хочу, что-бы при нажатии на кнопку грид исчезал.
Примерно так:
Код: <Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Window.Resources>
<Storyboard x:Key="Animation">
<DoubleAnimationUsingKeyFrames BeginTime="00:00:00"
Storyboard.TargetName="mygrid"
Storyboard.TargetProperty="Opacity">
<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
<SplineDoubleKeyFrame KeyTime="00:00:02.5000000" Value="0.55"/>
<SplineDoubleKeyFrame KeyTime="00:00:04.7000000" Value="0"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="25"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Button Content="Нажми меня!"
Grid.Row="0">
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard Storyboard="{StaticResource Animation}" />
</EventTrigger>
</Button.Triggers>
</Button>
<Grid Grid.Row="1"
Background="red"
x:Name="mygrid">
</Grid>
</Grid>
</Window>