Beispiel #1
0
        private void ExecuteSelectNextPage()
        {
            WizardPage nextPage = null;

            if (NextPageCommand?.CanExecute(CanSelectNextPage) == true)
            {
                NextPageCommand?.Execute(CanSelectNextPage);
            }

            if (CurrentPage != null)
            {
                var eventArgs = new RoutedEventArgs(NextEvent);
                this.RaiseEvent(eventArgs);
                //if (eventArgs.Cancel)
                //    return;

                //check next page
                if (CurrentPage.NextPage != null)
                {
                    nextPage = CurrentPage.NextPage;
                }
                else
                {
                    //no next page defined use index
                    var currentIndex  = Items.OfType <WizardPage>().ToList().IndexOf(CurrentPage);
                    var nextPageIndex = currentIndex + 1;
                    if (nextPageIndex < Items.OfType <WizardPage>().Count())
                    {
                        nextPage = Items.OfType <WizardPage>().ToList()[nextPageIndex];
                    }
                }
            }

            CurrentPage = nextPage;
        }
Beispiel #2
0
 protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs e)
 {
     base.OnPropertyChanged(e);
     if (
         e.Property.Name == nameof(CanSelectNextPage) ||
         (e.Property.Name == nameof(CanHelp)) ||
         (e.Property.Name == nameof(CanFinish)) ||
         (e.Property.Name == nameof(CanCancel)) ||
         (e.Property.Name == nameof(CanSelectPreviousPage)) ||
         (e.Property.Name == nameof(CurrentPage))
         )
     {
         CancelCommand?.CanExecute(CanCancel);
         FinishCommand?.CanExecute(CanFinish);
         PreviousPageCommand?.CanExecute(CanSelectPreviousPage);
         NextPageCommand?.CanExecute(CanSelectNextPage);
         HelpCommand?.CanExecute(CanHelp);
         UpdateButtonState();
     }
 }
Beispiel #3
0
        private void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            NextPageCommand.RaiseCanExecuteChanged();
            PrevPageCommand.RaiseCanExecuteChanged();

            ButtonNext.Visibility = NextPageCommand.CanExecute(null) ? Visibility.Visible : Visibility.Hidden;
            ButtonPrev.Visibility = PrevPageCommand.CanExecute(null) ? Visibility.Visible : Visibility.Hidden;

            LabelPage.Content = PageCount == 1 ? null : $"{Page + 1}/{PageCount}";

            if (ItemsSource == null)
            {
                return;
            }
            var pageSize = PageSize;

            PagedItemSource =
                new ObservableCollection <object>(
                    ItemsSource.OfType <object>().Skip(Page * pageSize).Take(pageSize).ToList());
            if (e.PropertyName == nameof(ItemsSource))
            {
                Page = 0;
            }
        }