繁体   English   中英

如何在UserControl的UserControl下访问控件

[英]How to access a control under the UserControl of UserControl

我有一个由几个父UserControl组成的主页,而某些父UserControl是由多个子UserControl组成的。

当前,我面临的问题是,我需要从主页访问RadioButtonList,并且特定的RadioButtonList位于子UserControl中。

主页包含父UserControl。

父UserControl包含子UserControl。

子用户控件包含一个RadioButtonList。

请帮忙。

向您的自定义用户控件添加属性以公开内部控件,如下所示:

public RadioButtonList RadioButtons { 
  get { return _radioButtons; }
}

相应地将该实例命名为_radioButtons

您可以在层次结构中一直执行此操作,尽管它会因深层的复合结构而变得混乱。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM