Exemplo n.º 1
0
        private void LayoutsListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            LayoutInfo newChoice = LayoutsListBox.SelectedItem as LayoutInfo;

            if (newChoice == CurrentSelectedLayoutInfo)
            {
                return;
            }

            CurrentSelectedLayoutInfo = newChoice;
            if (CurrentSelectedLayoutInfo != null)
            {
                LayoutsListBox.SelectedItem = Layouts.SelectedItem = CurrentSelectedLayoutInfo;
                Layouts.ScrollIntoView(CurrentSelectedLayoutInfo);
            }
        }
Exemplo n.º 2
0
        private void Next_Click(object sender, RoutedEventArgs e)
        {
            List <LayoutInfo> infos = Layouts.ItemsSource as List <LayoutInfo>;

            if (infos == null)
            {
                return;
            }

            int index = infos.IndexOf(CurrentSelectedLayoutInfo);

            if (index >= infos.Count - 1)
            {
                index = -1;
            }
            CurrentSelectedLayoutInfo = infos.ElementAtOrDefault(index + 1);
            if (CurrentSelectedLayoutInfo != null)
            {
                LayoutsListBox.SelectedItem = Layouts.SelectedItem = CurrentSelectedLayoutInfo;
                Layouts.ScrollIntoView(CurrentSelectedLayoutInfo);
                LayoutsListBox.ScrollIntoView(CurrentSelectedLayoutInfo);
            }
        }