I have an IList which is a copy of SelectedItems within a DataGrid.
If I iterate through this IList and select an item. I am using a simple 'for()' statement to do this, instead of a 'foreach()' as I need the index.
How can then use this item to find the same item in the main items?
Let's say the third item out of SelectedItems is the one I'm trying to find, how do I find this in DataGrid.Items?
Same way as you find it in list
for(int i = 0; i < myDataGrid.Items.Count; i++)
{
if (((IList)myDataGrid.Items[i]) == myitem)
{
//Found Item
}
}
Make sure that the both are same instance, else it will always return false.