Guest User

Untitled

a guest
Jan 18th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. <DataTemplate DataType="{x:Type ViewModel:OpeningViewModel}">
  2. <view:OpeningView/>
  3. </DataTemplate>
  4.  
  5. <DataTemplate DataType="{x:Type ViewModel:SecondUCViewModel}">
  6. <view:SecondUCView/>
  7. </DataTemplate>
  8.  
  9. #endregion
  10.  
  11. #region Properties
  12.  
  13. public int CurrentPageIndex
  14. {
  15. get
  16. {
  17. if (this.CurrentPage == null)
  18. {
  19. return 0;
  20. }
  21. return _pages.IndexOf(this.CurrentPage);
  22. }
  23. }
  24.  
  25. public NavigationBaseViewModel CurrentPage
  26. {
  27. get { return _currentPage; }
  28.  
  29. private set
  30. {
  31. if (value == _currentPage)
  32. return;
  33.  
  34. _currentPage = value;
  35. OnPropertyChanged("CurrentPage");
  36. }
  37. }
  38.  
  39. private ICommand _NavigateBackCommand;
  40. public ICommand NavigateBackCommand
  41. {
  42. get
  43. {
  44. if (_NavigateBackCommand == null)
  45. {
  46. _NavigateBackCommand = new RelayCommand(param => this.MoveToPreviousPage(), param => CanMoveToPreviousPage);
  47. }
  48. return _NavigateBackCommand;
  49. }
  50. }
  51.  
  52.  
  53.  
  54. private bool CanMoveToNextPage
  55. {
  56. get
  57. {
  58. return this.CurrentPage != null && this.CurrentPage.CanMoveNext;
  59. }
  60. }
  61.  
  62. bool CanMoveToPreviousPage
  63. {
  64. get { return 0 < this.CurrentPageIndex && CurrentPage.CanMoveBack; }
  65. }
  66.  
  67. private void MoveToNextPage()
  68. {
  69. if (this.CanMoveToNextPage)
  70. {
  71. if (CurrentPageIndex >= _pages.Count - 1)
  72. Cancel();
  73. if (this.CurrentPageIndex < _pages.Count - 1)
  74. {
  75. this.CurrentPage = _pages[this.CurrentPageIndex + 1];
  76. }
  77. }
  78. }
  79.  
  80. void MoveToPreviousPage()
  81. {
  82. if (this.CanMoveToPreviousPage)
  83. {
  84. this.CurrentPage = _pages[this.CurrentPageIndex - 1];
  85. }
  86. }
Add Comment
Please, Sign In to add comment