int FindCurrentSectionPosition(int fromPosition)
        {
            IListAdapter adapter = Adapter;

            if (fromPosition >= adapter.Count)
            {
                return(-1);                               // dataset has changed, no candidate
            }
            if (adapter.GetType().IsAssignableFrom(typeof(ISectionIndexer)))
            {
                // try fast way by asking section indexer
                ISectionIndexer indexer         = (ISectionIndexer)adapter;
                int             sectionPosition = indexer.GetSectionForPosition(fromPosition);
                int             itemPosition    = indexer.GetPositionForSection(sectionPosition);
                int             typeView        = adapter.GetItemViewType(itemPosition);
                if (IsItemViewTypePinned(adapter, typeView))
                {
                    return(itemPosition);
                } // else, no luck
            }

            // try slow way by looking through to the next section item above
            for (int position = fromPosition; position >= 0; position--)
            {
                int viewType = adapter.GetItemViewType(position);
                if (IsItemViewTypePinned(adapter, viewType))
                {
                    return(position);
                }
            }
            return(-1); // no candidate found
        }
 public int GetPositionForSection(int section)
 {
     return(m_SectionIndexer.GetPositionForSection(section));
 }