浏览代码

Enable crop in contextmenu

Ruben 9 月之前
父节点
当前提交
ca03546a9d
共有 2 个文件被更改,包括 3 次插入1 次删除
  1. 1 1
      src/PicView.Avalonia/Views/MainView.axaml
  2. 2 0
      src/PicView.Avalonia/Views/MainView.axaml.cs

+ 1 - 1
src/PicView.Avalonia/Views/MainView.axaml

@@ -741,7 +741,7 @@
                     Command="{CompiledBinding CropCommand}"
                     Header="{CompiledBinding Crop,
                                              Mode=OneWay}"
-                    IsEnabled="False">
+                    x:Name="CropMenuItem">
                     <MenuItem.Icon>
                         <Path
                             Data="{StaticResource CropGeometry}"

+ 2 - 0
src/PicView.Avalonia/Views/MainView.axaml.cs

@@ -87,6 +87,8 @@ public partial class MainView : UserControl
             return;
         }
 
+        CropMenuItem.IsEnabled = CropFunctions.DetermineIfShouldBeEnabled(vm);
+
         // Set source for ChangeCtrlZoomImage
         // TODO should probably be refactored inside a command (It doesn't update the UI in the zoom view, so should be made into a command)
         if (!Application.Current.TryGetResource("ScanEyeImage", Application.Current.RequestedThemeVariant, out var scanEyeImage ))