PropertyGrid中的AutoDropDown [英] AutoDropDown in PropertyGrid
问题描述
你好,
我有一个PropertyGrid,其中包含来自我的对象的一些属性,而这些属性之一具有一个列表(如ComboBox).此属性具有StringConverter和UITypeEditor.
这些对象的方法被调用,并正确返回类型,那里还有DropDownBox ist,我可以单击它,然后向我显示值,依此类推,但是我不会按Triangle显示值,我将在其中单击任何地方.该属性以通过事件等显示下拉列表.
我是怎么做的?
我搜索了它,但未找到任何可能的结果. :(
问候
Lucki87
Hello,
i have a PropertyGrid with some Propertys from my Object, and One of these Properties has a List (Like ComboBox). This Property has a StringConverter and an UITypeEditor.
The Methods of these Objects were called, and return correctly Types, also the DropDownBox ist there and i can click this an he show me the Values and so on, but i will not press the Triangle to show the values, i will click anywhere in the property to display the drop-down list via Events or so.
How i make this ?
I searched for it, but nothing possible found Frown | :(
Greetings
Lucki87
推荐答案
如果属性类型是枚举,则应立即使用.
如果它更复杂,则必须创建一个自定义 TypeConverter [ ^ ]并覆盖其GetStandardValuesSupported()
,GetStandardValuesExclusive()
和GetStandardValues()
方法.
为了使显示的值可用,您将必须为CanConvertTo()
,ConvertTo()
,CanConvertFrom()
和ConvertFrom()
添加替代.它们用于将您的设置与下拉列表中显示的字符串进行转换.
If the property type is an enumeration, it should work out of the box.
If it is something more sophisticated, you will have to create a custom TypeConverter[^] and override itsGetStandardValuesSupported()
,GetStandardValuesExclusive()
andGetStandardValues()
methods.
To make the displayed values usable, you will have to add overrides forCanConvertTo()
,ConvertTo()
,CanConvertFrom()
andConvertFrom()
. They are used to convert your settings to/from the string that is displayed in the dropdown.
这篇关于PropertyGrid中的AutoDropDown的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!