private void PreviousPage_Click(object sender, RoutedEventArgs e) { int index = SelectedGroupList.IndexOf(SelectedItem); if (index == 0) { var groupIndex = GroupList.IndexOf(SelectedGroupList); if (groupIndex == 0) { return; } SelectedGroupList = GroupList[groupIndex - 1]; SelectedItem = SelectedGroupList.Last(); } else { SelectedItem = SelectedGroupList[index - 1]; } }
private void NextPage_Click(object sender, RoutedEventArgs e) { int index = SelectedGroupList.IndexOf(SelectedItem); if (index == SelectedGroupList.Count - 1) { var groupIndex = GroupList.IndexOf(SelectedGroupList); if (groupIndex == GroupList.Count - 1) { return; } SelectedGroupList = GroupList[groupIndex + 1]; SelectedItem = SelectedGroupList.First(); } else { SelectedItem = SelectedGroupList[index + 1]; } }