我在 WPF 中创建一个应用程序,窗口有一个 3 行的主网格。第 3 行有 3 个按钮,单击每个按钮时,第 2 网格行中会显示一个面板。我通过设置面板的可见性选项来实现这一点。但是,现在我想在面板变得可见时添加效果/动画。我不知道从哪里开始,所以请帮忙。
我的 xaml 代码与此类似
<Window>
<Grid>
<!-- 3row definitions -->
<Grid Grid.Row="0"> </Grid>
<Grid Name="panel1" Grid.row="1" Visibility="Hidden"></Grid>
<Grid Name="panel2" Grid.row="1" Visibility="Hidden"></Grid>
<Grid Name="panel3" Grid.row="1" Visibility="Hidden"></Grid>
<Grid Grid.Row="2"></Grid>
</Grid>
</Windows>
更改可见性的 Xaml.cs 代码与此类似
private void Image_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
panel1.Visibility = System.Windows.Visibility.Visible;
panel2.Visibility = System.Windows.Visibility.Hidden;
panel3.Visibility = System.Windows.Visibility.Hidden;
}