开发者

Simple Windows.Forms binding is failing using framework 4.0

开发者 https://www.devze.com 2022-12-26 20:32 出处:网络
This works under the .net framework 3.5 client. This fails under the .net framework 4.0 client. Was I doing something that was illegal under 3.5 but just happened to work, or is this a bug?

This works under the .net framework 3.5 client.

This fails under the .net framework 4.0 client.

Was I doing something that was illegal under 3.5 but just happened to work, or is this a bug?

Note that in my project 'PropInt' does not raise change events so using ctx[obj1.PropObj2, "PropInt"] is not an option.

public class Obj1
{
    public Obj2 PropObj2 { get; set; }

    public Obj1()
    {
        PropObj2 = new Obj2();
    }
}

public class Obj2
{
    public int PropInt { get; set; }
}

static class Program
{
    [STAThread]开发者_运维知识库
    static void Main()
    {
        var ctx = new BindingContext();
        var obj1 = new Obj1();
        var x1 = ctx[obj1, "PropObj2.PropInt"];
    }
}


This is looking like a bug in PropertyManager.GetItemProperties(PropertyDescriptor[] listAccessors).

0

精彩评论

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