Simple Windows.Forms binding is failing using framework 4.0.

Posted by jyoung on Stack Overflow See other posts from Stack Overflow or by jyoung
Published on 2010-04-16T02:29:32Z Indexed on 2010/04/16 2:33 UTC
Read the original article Hit count: 261

Filed under:
|
|
|

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"];
    }
}

© Stack Overflow or respective owner

Related posts about .NET

Related posts about winforms