Hi @K, Arivalagan ,
You could use a separate data source for it.
A simpler example:
List<string> list1 = new List<string>();
List<string> list2 = new List<string>();
public void ListView()
{
InitializeComponent();
list1.Add("a");
list1.Add("b");
list1.Add("c");
this.ComboBox1.ItemsSource = list1;
this.ComboBox2.ItemsSource = list1;
}
Handle it like this:
private void ComboBox1_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
ComboBox2.SelectedIndex = -1;
string tmp = ComboBox1.SelectedValue as string;//Save the selection of combobox1
list2.Clear();
list2.AddRange(list1);
list2.Remove(tmp);
ComboBox2.ItemsSource = null;
ComboBox2.ItemsSource = list2;
}
Output:
Best Regards,
Jiale
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.