Property Grid Custom Dropdown的行为不符合我的预期 [英] Property Grid Custom Dropdown not behaving as I expected

查看:112
本文介绍了Property Grid Custom Dropdown的行为不符合我的预期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个应用程序,允许用户创建特定对象的多个实例(如Widget类中所定义),设置属性然后执行操作在对象列表上,按其中一个对象属性指定的顺序。 我正在使用属性网格来允许用户在运行时编辑所选对象属性。

The Widget class has a method GetAllowedPositions that returns a TypeConverter.StandardValuesCollection containing an array of strings {"1", "2", ... n} where n is the number of items in the list.

对象的Order属性包含执行顺序对于该实例,作为整数,并应设置为1到列表中项目数之间的数字,并具有属性[TypeConverter(typeof(OrderTypeConverter))]。

OrderTypeConverter类如下:

The OrderTypeConverter class is as follows:




代码块

推荐答案

 

根据我的理解,发生此错误是因为您覆盖GetStandardValuesExclusive方法并始终为该方法返回true。为了达到这个目的,我更喜欢以下方式。




代码块


这篇关于Property Grid Custom Dropdown的行为不符合我的预期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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