UserControl1.axaml.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using Avalonia;
  2. using Avalonia.Animation.Easings;
  3. using Avalonia.Animation;
  4. using Avalonia.Controls;
  5. using Avalonia.Markup.Xaml;
  6. using Avalonia.Media;
  7. using Avalonia.Styling;
  8. using AvaloniaApplicationKuzminIV.Models;
  9. using AvaloniaApplicationKuzminIV.ViewModels;
  10. using System;
  11. using System.Collections.Generic;
  12. namespace AvaloniaApplicationKuzminIV;
  13. public partial class UserControl1 : UserControl
  14. {
  15. public UserControl1()
  16. {
  17. InitializeComponent();
  18. DataContext = new PageStartAdminViewModel();
  19. }
  20. private void InitializeComponent()
  21. {
  22. AvaloniaXamlLoader.Load(this);
  23. }
  24. //private void StartColorAnimation()
  25. //{
  26. // var textBlock = this.FindControl<TextBlock>("ColorfulText");
  27. // var animation = new Animation
  28. // {
  29. // Duration = TimeSpan.FromSeconds(5),
  30. // IterationCount = IterationCount.Infinite,
  31. // Easing = new SplineEasing(0.4, 0.0, 0.2, 1.0),
  32. // Children =
  33. // {
  34. // new KeyFrame
  35. // {
  36. // Cue = new Cue(0),
  37. // Setters = { new Setter(TextBlock.ForegroundProperty, Brushes.Red) }
  38. // },
  39. // new KeyFrame
  40. // {
  41. // Cue = new Cue(0.33),
  42. // Setters = { new Setter(TextBlock.ForegroundProperty, Brushes.Green) }
  43. // },
  44. // new KeyFrame
  45. // {
  46. // Cue = new Cue(0.66),
  47. // Setters = { new Setter(TextBlock.ForegroundProperty, Brushes.Blue) }
  48. // },
  49. // new KeyFrame
  50. // {
  51. // Cue = new Cue(1),
  52. // Setters = { new Setter(TextBlock.ForegroundProperty, Brushes.Red) }
  53. // }
  54. // }
  55. // };
  56. // animation.RunAsync(textBlock, null);
  57. //}
  58. }