我在C#
中创建了一个windows custom control
,它继承自TextBox
。如何在自定义控件中添加动态属性
在我的控制,我的两个属性,即Continent
和Country
所以,我需要给提供选择洲和国家的用户。
i。 e,如果用户需要选择大陆,我将列出所有七大洲,那时国家名单将是空的,
一旦用户选择了大陆,那么country
列表应该填写选定大陆的国家。
我知道我可以使用enum
这个
即
public enum Continents {Asia , Africa, Antartica, Australia, Europe, NorthAmerica, SouthAmerica }
和财产
public Continents Continent { get; set; }
,如果我这样设置,那么continent property
将提供的dropdown list
(名单大洲从上面的enum
)发送给用户,用户可以从中选择(从属性窗口)。
现在我的问题是,一旦continen
t被选中,那么用户应该能够从属性窗口中选择country
。
请帮我做这件事
那么问题是什么? – gideon 2012-03-15 05:18:58
@gideon:我无法设置'Country'属性,因为它是动态的。更多的我不知道'国家'的类型 – 2012-03-15 05:22:08