WPF: Multiple Types in ComboBox ItemsSource

  • Thread starter Thread starter Wonko the Sane
  • Start date Start date
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
 
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.
 
Back
Top