c# - 如何将可编辑的组合框添加到 System.Windows.Forms.PropertyGrid?

标签 c# .net propertygrid typeconverter

我有一个具有不同类型值的 System.Windows.Forms.PropertyGrid。对于特定项目,我想显示一个有用值列表以供选择。用户也可以键入一个新值。类似于传统下拉组合框的东西:

enter image description here

到目前为止,我有自己的 System.ComponentModel.TypeConverter,但我不知道如何获得带有建议值的下拉列表直接编辑值。请帮忙!

最佳答案

您可以通过实现自己的 UITypeEditor 来完成此操作.

我推荐阅读 Getting the Most Out of the .NET Framework PropertyGrid Control .特别是标题为 Providing a Custom UI for Your Properties 的部分演练如何为特定属性制作自定义控件。

关于c# - 如何将可编辑的组合框添加到 System.Windows.Forms.PropertyGrid?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9790188/

相关文章:

c# - 在 propertygrid 中将属性更改为组合框

c# - 一个对象可以比另一个对象长寿……这是什么意思?

c# - 允许使用多个系统显式转换器,但不允许使用多个用户显式转换器。为什么?

.net - powershell 或 net 发送带有身份验证的电子邮件

c# - 混合安全和不安全的 channel

c# - 在 UITypeEditor 的 EditValue 中访问额外的上下文数据

c# - 具有空和非空类别的 WinForms PropertyGrid

C# 填充 treeview 并在我无权读取的目录上出现错误

c# - 如何防止空格被修剪?

c# - IDataObject 拖放问题,从 __ComObject 转换