选择什么:自定义控件还是用户控件? [英] What to choise:Custom Control or User Control?

查看:122
本文介绍了选择什么:自定义控件还是用户控件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个由DatePicker和Label组成的控件.Label会告诉我们DatePicker中的星期几.该控件应该具有属性LabelVisibility(类似的东西),以便可以禁用它.它还应该能够实现样式并具有标准的控制行为.

I need to create a control which will consist of DatePicker and Label.The Label will tell us what day is pressed in DatePicker. This control should have a property LabelVisibility(something like that) to give possibility to disable it. Also it should be able to implement styles and have standart control behavior.

推荐答案

我认为您没有太多选择.您需要创建一个从用户控件继承的自定义控件.自己的用户控件没有多大用处.

可以直接从马的嘴里说:

UserControl类MSDN [
I don''t think you have much choice. You need to create a Custom Control inheriting from User Control. A user control on it''s own is not much use.

Here it is directly from the Horses mouth so to speak:

UserControl Class MSDN[^]

Provides an empty control that can be used to create other controls.


您要描述的是UserControl.


这篇关于选择什么:自定义控件还是用户控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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