【问题标题】:UltraGrid how to set a custom editor via EditorAttributeUltraGrid 如何通过 EditorAttribute 设置自定义编辑器
【发布时间】:2011-01-24 16:35:35
【问题描述】:

我正在尝试让 UltraGrid 使用通过编辑器属性设置的自定义编辑器。然而,它似乎忽略了设置,只使用它的内部编辑器。这是我的代码:

public class DialogEditor : UITypeEditor
{
    public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
    {
        return UITypeEditorEditStyle.Modal;
    }

    public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
    {
        MessageBox.Show("Testing 1,2,3");
        return base.EditValue(context, provider, value);
    }
}

public class TestContainer
{
    public TestContainer(int id, string name)
    {
        Id = id;
        Name = name;
    }

    [Editor(typeof(DialogEditor), typeof(UITypeEditor))]
    public int Id { get; set; }

    public string Name { get; set; }

    public override string ToString()
    {
        return string.Format("{0} : {1}", Id, Name);
    }
}

通过以下方式测试:

        var data = new List<object>
        { 
            new TestContainer(1, "one"),
            new TestContainer(2, "two"),
        };
        ultraGrid1.DataSource = data;

【问题讨论】:

    标签: c# infragistics ultrawingrid


    【解决方案1】:

    回答:你不能。 UITypeEditor 仅用于 PropertyGrids。 请改用 Infragistics 嵌入式编辑器。

    【讨论】:

      猜你喜欢
      • 2022-01-15
      • 1970-01-01
      • 1970-01-01
      • 2021-10-04
      • 1970-01-01
      • 1970-01-01
      • 2017-12-08
      • 1970-01-01
      • 2018-03-31
      相关资源
      最近更新 更多