Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 控件出现在屏幕上时的动画_C#_Wpf_Silverlight_Xaml_Animation - Fatal编程技术网

C# 控件出现在屏幕上时的动画

C# 控件出现在屏幕上时的动画,c#,wpf,silverlight,xaml,animation,C#,Wpf,Silverlight,Xaml,Animation,如标题所示,我如何才能做到这一点 我一直在阅读一些Silverlight/WPF动画教程,其中大多数只是教你如何根据不同的属性和动画设置控件的动画 比方说,如果我动态地将MyUserControl添加到列表框中,如何使MyUserControl在列表框中显示为动画?(即内部褪色,列表中的大小从0%到100%等) 我知道,在代码隐藏中,我可以专注地做以下伪代码: ListBox myListBox; MyUserControl myUC; myListBox.Items.Add(myUC); //

如标题所示,我如何才能做到这一点

我一直在阅读一些Silverlight/WPF动画教程,其中大多数只是教你如何根据不同的属性和动画设置控件的动画

比方说,如果我动态地将MyUserControl添加到列表框中,如何使MyUserControl在列表框中显示为动画?(即内部褪色,列表中的大小从0%到100%等)

我知道,在代码隐藏中,我可以专注地做以下伪代码:

ListBox myListBox;
MyUserControl myUC;
myListBox.Items.Add(myUC);
//Trigger animation against myUC
但我的意思是,我正在寻找可以应用于MyUserControl的东西。因此,无论MyUserControl添加到何处(即Grid、TabControl、ListBox、TreeView等),它都会在出现时播放动画

这可能吗?在Xaml或代码隐藏中


另外,对dummy的解释会很好,我在代码隐藏而不是xaml中的动画控制方面有更多的经验。

UserControl
定义中,您可以为
加载的
事件添加
触发器
,在该事件中,您可以通过
情节提要
启动必要的动画。如果您更喜欢代码隐藏,您可以添加一个
加载的
事件处理程序,并在那里启动一些动画