tags:

views:

21

answers:

0

Hello

I have two data grid objects. Let's say that my first dg is called source and second dg is called target. Both dg objects use observable collection as a source. I fill target dg based on selected items from source dg. Now for every item in target dg I want to find corresponding item in source dg. I tried to use IndexOf method but it doesn't seem to work. I always get -1.

To be more specific I created a view from one observable collection and use it as source dg items source.

 for (int i = 0; i < collection.Count; i++)
            {
                Series seria = collection[i];

                string sDocId = Enum.Format(typeof(ObjectsID), Enum.Parse(typeof(ObjectsID), seria.DocKind), "d");

                ObservableCollection<Series> sourceCollection = (ObservableCollection<Series>)collectionView.Source;

                int inputSeriesIndex = sourceCollection.IndexOf(seria);
                ...

Is there something I'm doing wrong?

What are the other ways to accomplish that?

Thanks