HomeView.axaml.cs 844 B

12345678910111213141516171819202122232425262728293031323334
  1. using ApplicationAvalonia.ViewModels;
  2. using Avalonia;
  3. using Avalonia.Controls;
  4. using Avalonia.Controls.Primitives;
  5. using Avalonia.Markup.Xaml;
  6. using System;
  7. namespace ApplicationAvalonia.Views;
  8. public partial class HomeView : UserControl
  9. {
  10. public HomeView()
  11. {
  12. InitializeComponent();
  13. }
  14. private void ToggleButton_Checked_1(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
  15. {
  16. var some = (ToggleButton)sender;
  17. var myParametr = some.CommandParameter;
  18. HomeViewModel.TakeCategory(Convert.ToInt32(myParametr));
  19. }
  20. private void ToggleButton_Unchecked_2(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
  21. {
  22. var some = (ToggleButton)sender;
  23. var myParametr = some.CommandParameter;
  24. HomeViewModel.TakeCategory(Convert.ToInt32(myParametr));
  25. }
  26. }