用户控制的可见性 [英] Visibility of User Control

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

问题描述

在我的应用程序中有一个侧边栏,它包含这两个组件:

In my application got one sidebar, which is holding this two component :

        <Grid x:Name="AF" Visibility="Visibility">
            <betata:AForm Height="508" VerticalAlignment="Top"/>
        </Grid>
        <Grid x:Name="AN" Visibility="Collapsed">
            <betata:ANav Height="508" VerticalAlignment="Top"/>
        </Grid>

在 AForm 中使用此方法获得超链接按钮:

in the AForm got hyperlink button with this method :

    private void HyperlinkButton_Click(object sender, RoutedEventArgs e)
    {
        Visibility = Visibility.Collapsed;
        Sidebar sb = new Sidebar();
        sb.AN.Visibility = Visibility.Visible;
    }

但我不确定为什么 aForm 会折叠但 AN 无法显示.或者有没有其他解决方案可以实现::

but i not sure why the aForm will collapsed but AN could not become visible. or is there any other solution to implement ::

主页中的这一行调用UC_A ::

this line in main page to call up UC_A ::

<DWDS_LULCS_Views_Sidebar:Sidebar HorizontalAlignment="Left" Width="264"/>

  • 主页控股
  • 用户控件 A(边栏)控股
  • 用户控制 B(管理员登录表单)和
  • 用户控制 C(管理导航菜单)
  • UC_B默认可见,点击UC_B中的按钮调用UC_A的UC_C将可见性改为可见?

    UC_B default is visible, and click the button in UC_B to call UC_A's UC_C change the visibility to visible ?

    推荐答案

    终于解决了这个问题...我就是这样的,在全局变量中做一些东西来验证是否要使其可见和折叠,然后给出一个侧边栏的事件处理程序(layout_updated).当我修改 UC_B 的可见性时,UC_A 将受到影响并且触发器将被调用.最后,UC_A 的 layout_updated 事件将改变 UC_C 的可见性变为可见.

    Finally this problem is being solve... i do in this way, make something in global variable for verification whether which to make visible and collapse, then give one event handler to sidebar (layout_updated). when i modify the visibility of UC_B, UC_A will being affected and the trigger will be call. lastly, the UC_A's layout_updated event will change the visibility of UC_C become visible.

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

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