开发者

Property explorer: bound data source

开发者 https://www.devze.com 2023-03-30 19:56 出处:网络
Good day, I am creating a custom control based on the standard windows control TreeView. I\'m implementing data binding开发者_JAVA百科 - which is working nicely - but I\'m looking for a way to select

Good day,

I am creating a custom control based on the standard windows control TreeView. I'm implementing data binding开发者_JAVA百科 - which is working nicely - but I'm looking for a way to select the data source from a list in the property explorer - much like the ComboBox's DataSource property. My data source property currently looks something like this:

    [
        Description("Gets or sets a value representing the bound data source."),
        DefaultValue(null),
        Browsable(true)
    ]
    public object DataSource
    {
        get{ return _oDataSource; }
        set{ /* binding */ }
    }

I assume there is some attribute I have to set; or perhaps the data source needs to be of a specific type.

Thanx in advance for any comments and suggestions.

Kind regards, me


Try adding an AttributeProvider attribute pointing to IListSource, as in the stock ComboBox's definition of it's DataSource property:

    [RefreshProperties(RefreshProperties.Repaint)]
    [AttributeProvider(typeof (IListSource))]
    [DefaultValue(null)]
    public new object DataSource { get; set; }
0

精彩评论

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