Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Data Binding / October 2005

Tip: Looking for answers? Try searching our database.

Deepbinding: ICustomTypeDescriptor problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kpax - 12 Oct 2005 11:50 GMT
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.

Does anyone have idea about what can be the problem? If needed I can send my
test application...

Thanks in advance...

Ipek
Bart Mermuys - 12 Oct 2005 15:29 GMT
Hi,

> Hi,
>
[quoted text clipped - 33 lines]
> (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

> Does anyone have idea about what can be the problem? If needed I can send
> my
[quoted text clipped - 3 lines]
>
> Ipek

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.