Browse Source

Enable crop in contextmenu

Ruben 9 months ago
parent
commit
ca03546a9d

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

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

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

@@ -87,6 +87,8 @@ public partial class MainView : UserControl
             return;
             return;
         }
         }
 
 
+        CropMenuItem.IsEnabled = CropFunctions.DetermineIfShouldBeEnabled(vm);
+
         // Set source for ChangeCtrlZoomImage
         // 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)
         // 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 ))
         if (!Application.Current.TryGetResource("ScanEyeImage", Application.Current.RequestedThemeVariant, out var scanEyeImage ))