C# nested bindingsource parent-children relation
<p>To make my problem easier to understand let's assume we have a form having 2 combo-boxes (parent combo and child combo). When you select the parent combobox the child combobox's items change accordingly. State County is a good example.</p>

<p>Below is the data model.</p>

<pre><code>public class item
{
    public string childname { get; set; }
    public item(string n) { childname = n; }
}

public class itemparent
{
    public BindingSource&lt;item&gt; Children { get; set; }

    public string parentName { get; set; }

    public itemparent(string parentname,item n)
    {
        Children = new BindingSource&lt;item&gt;();

        this.parentName = parentname;
    }
}


public class BindingSource&lt;T&gt; : BindingSource
{
    public new T Current
    {
        get
        {
            return (T)base.Current;
        }
    }
}
</code></pre>

<p>And below is how i bind them.</p>

<pre><code>        public BindingSource&lt;itemparent&gt; bsource { get; set; }
    private void Form1_Load(object sender, EventArgs e)
    {
        try
        {
            this.bsource = new BindingSource&lt;itemparent&gt;()
            {
                new itemparent("parent Henry",new item("child name Marry")) ,
                new itemparent("parent Todd",new item("child name Alex")) 
            };

            //this works fine
            var bnd = new Binding("DataSource", this, "bsource");
            this.combo_parents.DataBindings.Add(bnd);
            this.combo_parents.DisplayMember = "parentName";

             //not working as i expect it, does not uplate data source if the above combo changes
            //and i cannot bind to bsource.Children.Current (throws exception complaining that Current prop no found)
            combo_children.DataBindings.Add("DataSource", this, "bsource.Children");
            combo_children.DisplayMember = "childname";

        }
        catch (Exception ex)
        {
            Debugger.Break();
        }
    }
}
</code></pre>

<p>I want to use the bindingsource.current for children also and be able to do:</p>

<pre><code> Get Selected Parent Item
 bsource.Current
 Get Selected Child item
 bsource.Current.Children.Current
</code></pre>

<p>I know that there are other ways to do it but i find this way to be the cleanest. Do the bindings then at any point using the BindingSource you can get the selected item.
Full VStudio solution of this tryout is available <a href="https://www.dropbox.com/s/8r75rkddaglkbkz/WindowsFormsApplication2.zip?dl=0" rel="nofollow">here</a>.</p>