Ejemplo n.º 1
0
 public static void SetState(ListView list, ListState state)
 {
     if (state.fTopIndex != -1 && state.fTopIndex < list.Items.Count)
     {
         list.TopItem = list.Items[state.fTopIndex];
     }
     if (state.fSelectedIndex != -1 && state.fSelectedIndex < list.Items.Count)
     {
         list.SelectedIndices.Add(state.fSelectedIndex);
     }
 }
Ejemplo n.º 2
0
        public static ListState GetState(ListView list)
        {
            ListState listState = new ListState()
            {
                fTopIndex      = list.Items.IndexOf(list.TopItem),
                fSelectedIndex = -1
            };

            if (list.SelectedIndices.Count != 0)
            {
                listState.fSelectedIndex = list.SelectedIndices[0];
            }
            return(listState);
        }