UserControl and BindingContext



I have created a UserControl that encapsulates a third party data grid.
My goal was to create my own DataSource and DataMember properties that
forward the binding to the third party grid, then use binding like
normal.

The problem I am running into is that my UserControl ends up with a
different BindingContext then the ParentForm it is contained in and
thus all other controls on the parent form. (I want various controls
on the form to update as I move between rows in the grid).

As far as I can tell the BindingContext of my user control and the
underlying third party grid get set when the DataSource property is
set. The DataSource property is set before the UserControl is added to
the controls collection on the ParentForm.

I would like my UserControl to use the same BindingContext as the
ParentForm. Does anyone know how to accomplish this so that my
DataSource and is connected to the ParentForm BindingContext?


Any help is appreciated, would gladly post code snippets or clarify any
questions.
~ Adam dR.

.



Relevant Pages

  • Re: UserControl and BindingContext
    ... Another workaround for when the DataSource property of the UserControl is ... So it doesn't matter what BindingContext was used, ... set after the UserControl is added to the Controls collection of the Form: ... As far as I can tell the BindingContext of my user control and the ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: UserControl and BindingContext
    ... Another workaround for when the DataSource property of the UserControl is ... So it doesn't matter what BindingContext was used, ... set after the UserControl is added to the Controls collection of the Form: ... As far as I can tell the BindingContext of my user control and the ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: UserControl and BindingContext
    ... Another workaround for when the DataSource property of the UserControl is ... So it doesn't matter what BindingContext was used, ... set after the UserControl is added to the Controls collection of the Form: ... As far as I can tell the BindingContext of my user control and the ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: UserControl and BindingContext
    ... DataTable doesn't unless DataSource is set after the UserControl is added to ... As far as I can tell the BindingContext of my user control and the ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: UserControl and BindingContext
    ... In order for the BindingContext to be the same, ... DataMember properties of the data-bound control have to be the same as the ... yourControl.DataSource = dataSource; ... If you are using property bindings for controls on the Form then the data ...
    (microsoft.public.dotnet.languages.csharp)

Loading