Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <DataTemplate DataType="{x:Type ViewModel:OpeningViewModel}">
- <view:OpeningView/>
- </DataTemplate>
- <DataTemplate DataType="{x:Type ViewModel:SecondUCViewModel}">
- <view:SecondUCView/>
- </DataTemplate>
- #endregion
- #region Properties
- public int CurrentPageIndex
- {
- get
- {
- if (this.CurrentPage == null)
- {
- return 0;
- }
- return _pages.IndexOf(this.CurrentPage);
- }
- }
- public NavigationBaseViewModel CurrentPage
- {
- get { return _currentPage; }
- private set
- {
- if (value == _currentPage)
- return;
- _currentPage = value;
- OnPropertyChanged("CurrentPage");
- }
- }
- private ICommand _NavigateBackCommand;
- public ICommand NavigateBackCommand
- {
- get
- {
- if (_NavigateBackCommand == null)
- {
- _NavigateBackCommand = new RelayCommand(param => this.MoveToPreviousPage(), param => CanMoveToPreviousPage);
- }
- return _NavigateBackCommand;
- }
- }
- private bool CanMoveToNextPage
- {
- get
- {
- return this.CurrentPage != null && this.CurrentPage.CanMoveNext;
- }
- }
- bool CanMoveToPreviousPage
- {
- get { return 0 < this.CurrentPageIndex && CurrentPage.CanMoveBack; }
- }
- private void MoveToNextPage()
- {
- if (this.CanMoveToNextPage)
- {
- if (CurrentPageIndex >= _pages.Count - 1)
- Cancel();
- if (this.CurrentPageIndex < _pages.Count - 1)
- {
- this.CurrentPage = _pages[this.CurrentPageIndex + 1];
- }
- }
- }
- void MoveToPreviousPage()
- {
- if (this.CanMoveToPreviousPage)
- {
- this.CurrentPage = _pages[this.CurrentPageIndex - 1];
- }
- }
Add Comment
Please, Sign In to add comment