开发者

UltraGrid how to set a custom editor via EditorAttribute

I am trying to get an UltraGrid to use a custom editor set via the Editor Attribute. However it seems to ignore the setting and just use its internal editor. Here is my code:

public class DialogEditor : UITypeEditor
{
    public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext contex开发者_JS百科t)
    {
        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);
    }
}

Tested via:

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


Answer: You can't. UITypeEditor are only used for PropertyGrids. Use the Infragistics Embeddable Editors instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜