Hi,
[quoted text, click to view] "kpax" <someone@somewhere.com> wrote in message
news:%23nRqbqxzFHA.3896@TK2MSFTNGP10.phx.gbl...
> Hi,
>
> I'm trying to implement deepbinding for my custom business objects.
> I have written two custom classes:
> BindableObject which implements ICustomTypeDescriptor
> BindableCollection which inherits CollectionBase, ITypedList,
> IListSource
>
> Then for test I have created the following objects:
> Author (inherits from BindableObject) with properties Name, Birthday
> Book (inherits from BindableObject) with properties Name, PageCount,
> Author, Auhors (inherits from BindableCollection)
> BookCollection (inherits from BindableCollection)
>
> On a form, I put a DataGridView1 and BindingSource1 and set the DataSource
> property of grid to BindingSource1.
> Then I set the DataSource property of the BindingSource1 to my Book class
> (through Add Project Data Source...).
>
> My deep binding works until this point. I see the Author.Name,
> Author.Birthday columns on the grid.
>
> The problem is with the Authors property of Book class. Since it is a
> collection I want to show the Authors of the selected book in another
> grid.
> So I put another DataGridView2 and BindingSource2 component. This time I
> set
> the DataSource property of BindingSource2 to BindingSource1
> (master-detail).
> But when I want to set the DataMember property of BindingSource2 as
> "Authors" nothings comes to the list. I try to set it programmatically and
> hope that it will find it at runtime, but this also does not work.
>
> But I found that the problem comes from ICustomTypeDescriptor
> implementation. If I do not implement this for my BindableObject class
> (which is key of my deepbinding solution) I see the Authors in the
> DataMember list of the BindingSource component.
If i understand it right, then by deep binding you mean implementing
ICustomTypeDescriptor for the Book class so that it exposes (aggregates) the
properties of the Author class it refers, it works, but then Authors
property isn't available anymore.
I quess the problem is most likely within the GetProperties implementations
of ICustomTypeDescriptor, if you can post some relevant code.
hth,
greetings
[quoted text, click to view] >
> Does anyone have idea about what can be the problem? If needed I can send
> my
> test application...
>
> Thanks in advance...
>
> Ipek
>
>
>