WPF: Multiple Types in ComboBox ItemsSource

W

Wonko the Sane

Hello,

I have two data-bound comboboxes (using List<Class1> and List<Class2>),
which are both displayed but have mutually exclusive options. A value should
be taken from one or the other as an option for the user.

As such, I'd like to put "Uses ClassX" as the first item in each of the lists:

Combo1 Combo2
--------- -----------
Use Class2 Use Class1
Class1 Item1 Class2 Item1
Class1 Item2 Class2 Item2
etc. etc.

These combos are being bound in code. Is there a way to add the "Use
ClassX" as an item in a bound list?

Thanks,
WtS
 
W

Walter Wang [MSFT]

Hi WtS,

I think you can use CompositeCollection to do this. It can combine multiple
sources for databinding. Here's some example:
http://martijnh.blogspot.com/2006/10/wpf-using-compositecollection-to.html


Regards,
Walter Wang ([email protected], remove 'online.')
Microsoft Online Community Support

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top