Xaml Grid Visibility Transitions

荒凉一梦 提交于 2019-12-11 13:07:10

问题


Since I cannot find any official documentation about it I need to ask this questions. Is there any way to animate grids on visibility change?

I have tried adding TransitionCollections to grids but it works only the first time that grid initialized.

I also tried this answer but it also wont work because Grid.Loaded event fires even if grid is collapsed.


回答1:


You can use event Loaded(). Just add attributes in XAML

 x:DeferLoadStrategy="Lazy" Visibility="Collapsed"

and element will be completely collapsed.
To load it use somewhere in C# code standart:

SomeHiddenElement.Visibility = Visibility.Visible;


来源:https://stackoverflow.com/questions/36795144/xaml-grid-visibility-transitions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!