public int GetGlobalIndexOfItem(object group, object item) { if (!IsGroupingEnabled) { return(ListProxy.IndexOf(item)); } var count = 0; if (_groupedItems != null) { foreach (KeyValuePair <object, TemplatedItemsList <TView, TItem> > kvp in _groupedItems) { count++; if (ReferenceEquals(group, kvp.Key)) { int index = kvp.Value.GetGlobalIndexOfItem(item); if (index != -1) { return(count + index); } } count += kvp.Value.GetDescendantCount(); } } return(-1); }
public int GetGlobalIndexOfItem(object item) { if (!IsGroupingEnabled) { return(ListProxy.IndexOf(item)); } var count = 0; if (_groupedItems != null) { foreach (TemplatedItemsList <TView, TItem> children in _groupedItems.Values) { count++; int index = children.GetGlobalIndexOfItem(item); if (index != -1) { return(count + index); } count += children.GetDescendantCount(); } } return(-1); }