Xaml网格可见性转换 [英] Xaml Grid Visibility Transitions

查看:138
本文介绍了Xaml网格可见性转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于我找不到任何有关它的官方文档,我需要提出这些问题。是否有任何方法来动画可视性变化的网格?

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?

我曾尝试添加 TransitionCollection s到网格,但它的工作原理只有第一次格子初始化。

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

我也试过这个答案,但它也不会工作,因为即使网格被折叠, Grid.Loaded 事件也会触发。

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

推荐答案

您可以使用事件Loaded()。只需在XAML中添加属性

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

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

并且元素将被完全折叠。

在C#代码standart中加载它:

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

SomeHiddenElement.Visibility = Visibility.Visible;

这篇关于Xaml网格可见性转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆