AnimationsPageViewModel.cs 675 B

1234567891011121314151617181920212223242526
  1. using System;
  2. using MiniMvvm;
  3. using Avalonia.Animation;
  4. namespace RenderDemo.ViewModels
  5. {
  6. public class AnimationsPageViewModel : ViewModelBase
  7. {
  8. private bool _isPlaying = true;
  9. private string _playStateText = "Pause animations on this page";
  10. public void TogglePlayState()
  11. {
  12. PlayStateText = _isPlaying
  13. ? "Resume animations on this page" : "Pause animations on this page";
  14. _isPlaying = !_isPlaying;
  15. }
  16. public string PlayStateText
  17. {
  18. get { return _playStateText; }
  19. set { this.RaiseAndSetIfChanged(ref _playStateText, value); }
  20. }
  21. }
  22. }