GalleryShortcut.axaml.cs 630 B

12345678910111213141516171819202122
  1. using Avalonia.Controls;
  2. using PicView.Avalonia.UI;
  3. using PicView.Avalonia.ViewModels;
  4. namespace PicView.Avalonia.Views.UC.Buttons;
  5. public partial class GalleryShortcut : UserControl
  6. {
  7. public GalleryShortcut()
  8. {
  9. InitializeComponent();
  10. Loaded += delegate
  11. {
  12. if (DataContext is not MainViewModel vm)
  13. {
  14. return;
  15. }
  16. HideInterfaceLogic.AddHoverButtonEvents(this, InnerButton, DataContext as MainViewModel);
  17. PointerWheelChanged += async (_, e) => await vm.ImageViewer.PreviewOnPointerWheelChanged(this, e);
  18. };
  19. }
  20. }