Hi All.
I created form with two ComboBox. And I would like that selection in ComboBox1 filter ComboBox2.
Here is my code to populate ComboBox1:
public partial class Window1 : Window
{
MyDataSet ds = new MyDataSet();
MyDataSetTableAdapters.Table1TableAdapter tb1TableAdapter = new MyDataSetTableAdapters.Table1TableAdapter();
MyDataSetTableAdapters.Table2TableAdapter tb2TableAdapter = new MyDataSetTableAdapters.Table2TableAdapter();
BindingListCollectionView cvCombo1;
BindingListCollectionView cvCombo2;
public Window1()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
PopulateCombo1();
}
public void PopulateCombo1()
{
tb1TableAdapter.Fill(ds.Table1);
cvCombo1 = ((BindingListCollectionView)(CollectionViewSource.GetDefaultView(ds.Table1)));
CollectionViewSource cb1Source = FindResource("cvCombo1") as CollectionViewSource;
cb1Source.Source = ds.Table1;
}
public void PopulateCombo2()
{
tb2TableAdapter.Fill(ds.Table2);
cvCombo2 = ((BindingListCollectionView)(CollectionViewSource.GetDefaultView(ds.Table2)));
CollectionViewSource cb2Source = FindResource("cvCombo2") as CollectionViewSource;
cb2Source.Source = ds.Table2;
}
}
How to filter ComboBox2?
Thanks.