用户控件的基本属性 [英] Base property for User Control

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

问题描述

我想让我的用户控件具有Toolbox中的TextBox和Label,并在我想使用该控件的项目中具有基类TextBox和Label的属性.
当我创建控件的对象时,我想访问控件的TextBox及其属性..
谢谢!

I want to my User Control which has TextBox and Label from Toolbox have property from base class TextBox and Label in project where I want to use that control.
When I create object of my control I want to access TextBox of my control and its property..
Thank you!

推荐答案

以下 [ ^ ]文章可能帮你.好东西在第二页上.

它涵盖了Dependency Properties,这是实现您要执行的操作的一种方法.
Following this[^] article may help you. The good stuff is on the 2nd page and on.

It covers Dependency Properties which is one way to achieve what you want to do.


您应该能够做到这一点,而无需进行任何更改,因为默认情况下,控制变量是使用internal 生成的可见性.

[edit]它们是internal ,而不是我最初发布的public .
You should be able to do this without any changes because by default the control variables are generated with internal visibility.

[edit] they are internal and not public as I had originally posted.


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

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