如何从子控件设置父控件的可见性 [英] How to set visibility of parent control from child control

查看:70
本文介绍了如何从子控件设置父控件的可见性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我从用户控件设计了一个页面加载控件,该控件具有一些旋转和颜色变化的动画.我显示的是,当我单击所需菜单按钮时,在浏览页面时在主页上加载控件(用户控件),加载控件的可见性变为可见.但是,当欲望页面被加载时,我将加载控件的可见性设置为Collapsed,这没有发生.

在Menubutton的Click事件上,我使用以下代码将加载控件的Visibility属性设置为可见
ldgwnd.Visibility = Windows.Visibility.Visible

加载导航页面后.我通过以下代码将主页的加载控件的可见性"属性设置为已折叠",但无法正常工作,仍然可以在主页和导航页面上看到加载控件.

TryCast(Application.Current.RootVisual, MainPage).ldgwnd.Visibility = Windows.Visibility.Collapsed

请指导我如何将Loading控件的可见性设置为false

谢谢与问候
Anil

Hi All,

I designed one Page loading control from user control, which has some animation of rotation and color changing. I am showing that Loading control (user control) on Main Page while navigating the pages when I clicked the desire menu button the loading control visibility becomes Visible. But when desire page gets loaded, i set the visibility of that loading control is Collapsed which is not happening.

On Click event of Menubutton, I set loading control''s Visibility property to visible with below code
ldgwnd.Visibility = Windows.Visibility.Visible

After loading the navigation page. I set the Main Page''s loading control''s Visibility property to Collapsed with below code but its not working, Still loading control is visible on main page and also navigation page.

TryCast(Application.Current.RootVisual, MainPage).ldgwnd.Visibility = Windows.Visibility.Collapsed

Kindly guide me how the visibility of Loading control is set to false

Thanks and Regards
Anil

推荐答案

Got解决方案

试试这个

昏暗的mp = TryCast(Application.Current.RootVisual,MainPage)
mp.ldgwnd.Visibility = Windows.Visibility.Collapsed

尼尔
Got Solution

Try this

Dim mp = TryCast(Application.Current.RootVisual, MainPage)
mp.ldgwnd.Visibility = Windows.Visibility.Collapsed

Anil


这篇关于如何从子控件设置父控件的可见性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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