-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Cascading databound comboboxes with BindingSources...
PostPosted: Mon Feb 06, 2006 12:20 am 
Beginner
Beginner

Joined: Thu Dec 08, 2005 6:49 pm
Posts: 49
One cool thing about the new BindingSource object in 2.0 is that it can be cascaded very easily. You simply specify the first as the DataSource for the second and let it know what collection property to display. The datasource is automatically updated when the parent selection is changed.

Code:
IList countries = ListCountries();
BindingSource source1 = new BindingSource(countries, null);
BindingSource source2 = new BindingSource(source1, "States");
BindingSource source3 = new BindingSource(source2, "Cities");
comboBox1.DataSource = source1;
comboBox2.DataSource = source2;
comboBox3.DataSource = source3;

Unfortunately it seems like if the collection object ("States" and "Cities") does not implement IList, the cascading displays correctly at first but doesn't update automatically. Since ISet is an ICollection but not an IList, by default it would seem that this functionality cannot be leveraged when using NHibernate.

Does anybody know of another solution other than registering BindingManagerBase.PositionChanged events?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.