I have two list boxes in two different forms.. I load the data in to second list box using first list box...both have exactly same values.. but in first list box user selects multiple selections and i wanted to show them in second listbox as selected.. i have the following code but its only highlighting last item from selected items..please suggest me the modifications..
this.lstView2.ItemsSource = lstView1.ItemsSource;
//the above statement brings the values from lstView1 into lstView2
foreach (DataRowView currentItem in lstView2.Items)
{
foreach (DataRowView item in lstView1.SelectedItems)
{
if (currentItem == item)
{
lstView2.SelectedItem = currentItem;
}
}
}