internal int ViewIndexOf(object item) { if (View == null) { return(-1); } CollectionView cv = View as CollectionView; if (cv != null) { return(cv.IndexOf(item)); } // As a last resort, use the IList interface or IndexedEnumerable to look for the item. if (ViewList != null) { return(ViewList.IndexOf(item)); } return(-1); }