"Benny" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I just cant find a good explanation on how to "deep bind" objects, so
> im hoping someone can help. I have an object that contains another
> object, for example: Book has a title, pagecount, and an Author. The
> title and pagecount are system objects but Author is a type i have
> definied. I need to know how i could bind the Author.FirstName
> property (for example) to the same grid like any property of the
> containing object. another example:
>
> datagrid1.DataSource = Books1;
> ...
> datacolumnstyle1.MappingName = "Title";
> ...
> datacolumnstyle2.MappingName = "Author.FirstName";
> ...
>
> There are a couple articles out there for doing this but there is no
> explanation on how to customize the code and im brand new to
> reflection. Any help would be greatly appreciated.
Are you saying that "Author.FirstName" doesn't work? I don't use datagrids
but, we do deep binding to other controls.
Here's how you would bind the Authors first name to a text control:
controlName.DataBindings.Add("Text", bindingSource,
"Author.FirstName");
In our code, "bindingSource" would be a BookCollection which contains a
collection of Books.
|