浏览代码

Theme updates, refactor, miscellaneous updates and more.

Ruben 1 年之前
父节点
当前提交
e4fd806db1

+ 2 - 1
src/PicView.Avalonia.MacOS/App.axaml.cs

@@ -84,7 +84,8 @@ public class App : Application, IPlatformSpecificService
 
     public void SetTaskbarProgress(ulong progress, ulong maximum)
     {
-        
+        // TODO: Implement SetTaskbarProgress
+        // https://github.com/carina-studio/AppSuiteBase/blob/master/Core/AppSuiteApplication.MacOS.cs#L365
     }
 
     public void StopTaskbarProgress()

+ 1 - 1
src/PicView.Avalonia.MacOS/Views/MacMainWindow.axaml

@@ -122,7 +122,7 @@
                 <NativeMenu>
                     <NativeMenuItem
                         Command="{CompiledBinding ToggleLoopingCommand}"
-                        Header="{CompiledBinding GetLooping}"
+                        Header="{CompiledBinding GetIsLoopingTranslation}"
                         IsChecked="{CompiledBinding IsLooping}"
                         ToggleType="CheckBox" />
                     <NativeMenuItem

+ 1 - 1
src/PicView.Avalonia.Win32/Views/AboutWindow.axaml

@@ -28,7 +28,7 @@
             <DockPanel Height="28" LastChildFill="True">
 
                 <Border
-                    Background="{DynamicResource WindowBackgroundColor}"
+                    Background="{DynamicResource WindowButtonBackgroundColor}"
                     BorderBrush="{DynamicResource MainBorderColor}"
                     BorderThickness="0,0,1,0"
                     CornerRadius="8,0,0,0"

+ 2 - 2
src/PicView.Avalonia.Win32/Views/KeybindingsWindow.axaml

@@ -30,10 +30,10 @@
                 VerticalAlignment="Top">
 
                 <Border
-                    Background="{DynamicResource WindowBackgroundColor}"
+                    Background="{DynamicResource WindowButtonBackgroundColor}"
                     BorderBrush="{DynamicResource MainBorderColor}"
                     BorderThickness="0,0,1,1"
-                    CornerRadius="8,8,0,0"
+                    CornerRadius="8,0,0,0"
                     DockPanel.Dock="Left"
                     x:Name="TopWindowBorder">
                     <Image

+ 1 - 1
src/PicView.Avalonia.Win32/Views/SettingsWindow.axaml

@@ -31,7 +31,7 @@
                 LastChildFill="True"
                 VerticalAlignment="Top">
                 <Border
-                    Background="{DynamicResource WindowBackgroundColor}"
+                    Background="{DynamicResource WindowButtonBackgroundColor}"
                     BorderBrush="{DynamicResource MainBorderColor}"
                     BorderThickness="0,0,1,1"
                     CornerRadius="8,0,0,0"

+ 1 - 0
src/PicView.Avalonia/Navigation/NavigationHelper.cs

@@ -34,6 +34,7 @@ public static class NavigationHelper
     {
         return vm?.ImageIterator?.ImagePaths is not null &&
                vm.ImageIterator.ImagePaths.Count > 0;
+        // TODO: should probably turn this into CanExecute observable for ReactiveUI
     }
     
     /// <summary>

+ 3 - 0
src/PicView.Avalonia/Navigation/UpdateImage.cs

@@ -155,6 +155,9 @@ public static class UpdateImage
         vm.GalleryMargin = new Thickness(0, 0, 0, 0);
 
         vm.PlatformService.StopTaskbarProgress();
+        
+        vm.PixelWidth = width;
+        vm.PixelHeight = height;
     }
 
     public static void LoadingPreview(MainViewModel vm, int index)

+ 11 - 0
src/PicView.Avalonia/SettingsManagement/LanguageUpdater.cs

@@ -11,11 +11,22 @@ public static class LanguageUpdater
         vm.UpdateLanguage();
 
         vm.GetIsFlippedTranslation = vm.ScaleX == 1 ? vm.Flip : vm.UnFlip;
+        
         vm.GetIsShowingUITranslation = !SettingsHelper.Settings.UIProperties.ShowInterface ? vm.ShowUI : vm.HideUI;
+        
         vm.GetIsScrollingTranslation = SettingsHelper.Settings.Zoom.ScrollEnabled ?
             TranslationHelper.Translation.ScrollingEnabled : TranslationHelper.Translation.ScrollingDisabled;
+        
         vm.GetIsShowingBottomGalleryTranslation = vm.IsGalleryShown ?
             TranslationHelper.Translation.HideBottomGallery :
             TranslationHelper.Translation.ShowBottomGallery;
+        
+        vm.GetIsLoopingTranslation = SettingsHelper.Settings.UIProperties.Looping
+            ? TranslationHelper.Translation.LoopingEnabled
+            : TranslationHelper.Translation.LoopingDisabled;
+        
+        vm.GetIsCtrlZoomTranslation = SettingsHelper.Settings.Zoom.CtrlZoom
+            ? TranslationHelper.Translation.CtrlToZoom
+            : TranslationHelper.Translation.ScrollToZoom;
     }
 }

+ 5 - 2
src/PicView.Avalonia/UI/DragAndDropHelper.cs

@@ -81,8 +81,11 @@ public static class DragAndDropHelper
         var files = e.Data.GetFiles();
         if (files == null)
         {
-            await HandleDragEnterFromUrl(e, vm);
-            return;
+            var handledFromUrl = await HandleDragEnterFromUrl(e, vm);
+            if (!handledFromUrl)
+            {
+                RemoveDragDropView();
+            }
         }
 
         await HandleDragEnter(files, e, vm, control);

+ 0 - 11
src/PicView.Avalonia/UI/StartUpHelper.cs

@@ -10,7 +10,6 @@ using PicView.Avalonia.ViewModels;
 using PicView.Avalonia.Views;
 using PicView.Core.Config;
 using PicView.Core.Gallery;
-using PicView.Core.Localization;
 using StartUpMenu = PicView.Avalonia.Views.StartUpMenu;
 
 namespace PicView.Avalonia.UI;
@@ -151,16 +150,6 @@ public static class StartUpHelper
         
         Task.Run(KeybindingsHelper.LoadKeybindings);
         
-        vm.GetLooping = SettingsHelper.Settings.UIProperties.Looping
-            ? TranslationHelper.Translation.LoopingEnabled
-            : TranslationHelper.Translation.LoopingDisabled;
-        vm.GetIsScrollingTranslation = SettingsHelper.Settings.Zoom.ScrollEnabled
-            ? TranslationHelper.Translation.ScrollingEnabled
-            : TranslationHelper.Translation.ScrollingDisabled;
-        vm.GetCtrlZoom = SettingsHelper.Settings.Zoom.CtrlZoom
-            ? TranslationHelper.Translation.CtrlToZoom
-            : TranslationHelper.Translation.ScrollToZoom;
-        
         UIHelper.AddMenus();
 
         w.KeyDown += async (_, e) => await MainKeyboardShortcuts.MainWindow_KeysDownAsync(e).ConfigureAwait(false);

+ 2 - 7
src/PicView.Avalonia/UI/UIHelper.cs

@@ -192,11 +192,6 @@ namespace PicView.Avalonia.UI
 
         public static async Task Flip(MainViewModel vm)
         {
-            if (!NavigationHelper.CanNavigate(vm))
-            {
-                return;
-            }
-
             if (vm.ScaleX == 1)
             {
                 vm.ScaleX = -1;
@@ -215,7 +210,7 @@ namespace PicView.Avalonia.UI
         {
             var value = !SettingsHelper.Settings.UIProperties.Looping;
             SettingsHelper.Settings.UIProperties.Looping = value;
-            vm.GetLooping = value
+            vm.GetIsLoopingTranslation = value
                 ? TranslationHelper.Translation.LoopingEnabled
                 : TranslationHelper.Translation.LoopingDisabled;
             vm.IsLooping = value;
@@ -231,7 +226,7 @@ namespace PicView.Avalonia.UI
         public static async Task ChangeCtrlZoom(MainViewModel vm)
         {
             SettingsHelper.Settings.Zoom.CtrlZoom = !SettingsHelper.Settings.Zoom.CtrlZoom;
-            vm.GetCtrlZoom = SettingsHelper.Settings.Zoom.CtrlZoom
+            vm.GetIsCtrlZoomTranslation = SettingsHelper.Settings.Zoom.CtrlZoom
                 ? TranslationHelper.Translation.CtrlToZoom
                 : TranslationHelper.Translation.ScrollToZoom;
             

+ 8 - 8
src/PicView.Avalonia/ViewModels/MainViewModel.cs

@@ -826,12 +826,12 @@ public class MainViewModel : ViewModelBase
         set => this.RaiseAndSetIfChanged(ref _getIsShowingBottomGalleryTranslation, value);
     }
 
-    private string? _getLooping;
+    private string? _getIsLoopingTranslation;
 
-    public string? GetLooping
+    public string? GetIsLoopingTranslation
     {
-        get => _getLooping;
-        set => this.RaiseAndSetIfChanged(ref _getLooping, value);
+        get => _getIsLoopingTranslation;
+        set => this.RaiseAndSetIfChanged(ref _getIsLoopingTranslation, value);
     }
 
     private string? _getIsScrollingTranslation;
@@ -842,12 +842,12 @@ public class MainViewModel : ViewModelBase
         set => this.RaiseAndSetIfChanged(ref _getIsScrollingTranslation, value);
     }
 
-    private string? _getCtrlZoom;
+    private string? _getIsCtrlZoomTranslation;
 
-    public string? GetCtrlZoom
+    public string? GetIsCtrlZoomTranslation
     {
-        get => _getCtrlZoom;
-        set => this.RaiseAndSetIfChanged(ref _getCtrlZoom, value);
+        get => _getIsCtrlZoomTranslation;
+        set => this.RaiseAndSetIfChanged(ref _getIsCtrlZoomTranslation, value);
     }
 
     private string? _getPrintSizeInch;

+ 10 - 6
src/PicView.Avalonia/Views/AppearanceView.axaml

@@ -56,8 +56,9 @@
             FontFamily="/Assets/Fonts/Roboto-Bold.ttf#Roboto"
             FontSize="14"
             Foreground="{StaticResource SecondaryTextColor}"
-            Margin="0,20,0,20"
-            Text="{CompiledBinding HighlightColor}" />
+            Margin="0,5,0,20"
+            Text="{CompiledBinding HighlightColor,
+                                   Mode=OneWay}" />
 
         <WrapPanel
             HorizontalAlignment="Center"
@@ -163,8 +164,9 @@
             FontFamily="/Assets/Fonts/Roboto-Bold.ttf#Roboto"
             FontSize="14"
             Foreground="{StaticResource SecondaryTextColor}"
-            Margin="0,15,0,10"
-            Text="{CompiledBinding MiscSettings}" />
+            Margin="0,20,0,10"
+            Text="{CompiledBinding MiscSettings,
+                                   Mode=OneWay}" />
 
         <ToggleButton
             Background="Transparent"
@@ -180,7 +182,8 @@
                 Margin="0"
                 MaxWidth="240"
                 Padding="0,1,5,0"
-                Text="{CompiledBinding ShowBottomToolbar}" />
+                Text="{CompiledBinding ShowBottomToolbar,
+                                       Mode=OneWay}" />
         </ToggleButton>
 
         <ToggleButton
@@ -198,7 +201,8 @@
                 Margin="0"
                 MaxWidth="240"
                 Padding="0,1,5,0"
-                Text="{CompiledBinding GetIsShowingUITranslation}" />
+                Text="{CompiledBinding GetIsShowingUITranslation,
+                                       Mode=OneWay}" />
         </ToggleButton>
 
     </StackPanel>

+ 19 - 0
src/PicView.Avalonia/Views/ImageViewer.axaml.cs

@@ -230,6 +230,25 @@ public partial class ImageViewer : UserControl
         }
         var currentZoom = _scaleTransform.ScaleX;
         var zoomSpeed = SettingsHelper.Settings.Zoom.ZoomSpeed;
+        
+        switch (currentZoom)
+        {
+            // Increase speed based on the current zoom level
+            case > 15 when isZoomIn:
+                return;
+
+            case > 4:
+                zoomSpeed += 1;
+                break;
+
+            case > 3.2:
+                zoomSpeed += 0.8;
+                break;
+
+            case > 1.6:
+                zoomSpeed += 0.5;
+                break;
+        }
 
         if (!isZoomIn)
         {

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

@@ -190,7 +190,7 @@
                         Width="12" />
                 </MenuItem.Icon>
                 <MenuItem
-                    Header="{CompiledBinding GetLooping,
+                    Header="{CompiledBinding GetIsLoopingTranslation,
                                              Mode=OneWay}"
                     IsChecked="{Binding IsLooping}"
                     ToggleType="CheckBox" />
@@ -221,7 +221,7 @@
 
                 <Separator />
 
-                <MenuItem Command="{CompiledBinding ChangeCtrlZoomCommand}" Header="{CompiledBinding GetCtrlZoom, Mode=OneWay}">
+                <MenuItem Command="{CompiledBinding ChangeCtrlZoomCommand}" Header="{CompiledBinding GetIsCtrlZoomTranslation, Mode=OneWay}">
                     <MenuItem.Icon>
                         <Image
                             Height="12"

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

@@ -54,7 +54,7 @@
                 Margin="0"
                 MaxWidth="240"
                 Padding="0,1,5,0"
-                Text="{CompiledBinding GetLooping,
+                Text="{CompiledBinding GetIsLoopingTranslation,
                                        Mode=OneWay}" />
         </ToggleButton>
 

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

@@ -395,7 +395,7 @@
             <TextBlock
                 Classes="txt"
                 FontFamily="/Assets/Fonts/Roboto-Bold.ttf#Roboto"
-                Text="{CompiledBinding GetCtrlZoom}"
+                Text="{CompiledBinding GetIsCtrlZoomTranslation}"
                 Width="170" />
             <customControls:KeybindTextBox
                 Classes="hover TStyle"

+ 39 - 98
src/PicView.Avalonia/Views/UC/Menus/FileMenu.axaml

@@ -13,6 +13,23 @@
         <viewModels:MainViewModel />
     </Design.DataContext>
     <StackPanel>
+        <StackPanel.Styles>
+            <Styles>
+                <Style Selector="TextBlock.btnTxt">
+                    <Setter Property="MaxWidth" Value="137" />
+                    <Setter Property="VerticalAlignment" Value="Center" />
+                    <Setter Property="Foreground" Value="{DynamicResource MainTextColor}" />
+                </Style>
+                <Style Selector="Button.btn">
+                    <Setter Property="Width" Value="45" />
+                    <Setter Property="Height" Value="45" />
+                    <Setter Property="Background" Value="Transparent" />
+                    <Setter Property="BorderThickness" Value="0,0,1,0" />
+                    <Setter Property="BorderBrush" Value="{DynamicResource MainBorderColor}" />
+                    <Setter Property="Foreground" Value="{DynamicResource MainTextColor}" />
+                </Style>
+            </Styles>
+        </StackPanel.Styles>
         <Border
             Background="{DynamicResource MenuBackgroundColor}"
             BorderBrush="{DynamicResource MainBorderColor}"
@@ -31,123 +48,83 @@
                     x:Name="TopBorder" />
 
                 <customControls:IconButton
-                    Background="Transparent"
-                    BorderBrush="{DynamicResource MainBorderColor}"
-                    BorderThickness="0,0,1,0"
-                    Classes="hover"
+                    Classes="hover btn"
                     Command="{Binding ReloadCommand}"
                     CornerRadius="8,0,0,0"
                     Data="{StaticResource ReloadGeometry}"
-                    Foreground="{DynamicResource MainTextColor}"
-                    Height="45"
                     IconHeight="17"
                     IconWidth="17"
                     ToolTip.Tip="{CompiledBinding Reload,
-                                                  Mode=OneWay}"
-                    Width="45" />
+                                                  Mode=OneWay}" />
 
                 <customControls:IconButton
-                    Background="Transparent"
-                    BorderBrush="{DynamicResource MainBorderColor}"
-                    BorderThickness="0,0,1,0"
                     Canvas.Left="45"
-                    Classes="hover"
+                    Classes="hover btn"
                     Command="{CompiledBinding PrintCommand}"
                     CommandParameter="{CompiledBinding FileInfo.FullName,
                                                        FallbackValue=''}"
                     Data="{StaticResource PrintGeometry}"
-                    Foreground="{DynamicResource MainTextColor}"
-                    Height="45"
                     IconHeight="17"
                     IconWidth="17"
                     ToolTip.Tip="{CompiledBinding Print,
-                                                  Mode=OneWay}"
-                    Width="45" />
+                                                  Mode=OneWay}" />
 
                 <customControls:IconButton
-                    Background="Transparent"
-                    BorderBrush="{DynamicResource MainBorderColor}"
-                    BorderThickness="0,0,1,0"
                     Canvas.Left="90"
-                    Classes="hover"
+                    Classes="hover btn"
                     Command="{CompiledBinding RecycleFileCommand}"
                     CommandParameter="{CompiledBinding FileInfo.FullName,
                                                        FallbackValue=''}"
                     Data="{StaticResource RecycleGeometry}"
-                    Foreground="{DynamicResource MainTextColor}"
-                    Height="45"
                     IconHeight="17"
                     IconWidth="17"
-                    ToolTip.Tip="{CompiledBinding DeleteFile}"
-                    Width="45" />
+                    ToolTip.Tip="{CompiledBinding DeleteFile,
+                                                  Mode=OneWay}" />
 
                 <customControls:IconButton
-                    Background="Transparent"
-                    BorderBrush="{DynamicResource MainBorderColor}"
-                    BorderThickness="0,0,1,0"
                     Canvas.Left="135"
-                    Classes="hover"
+                    Classes="hover btn"
                     Command="{CompiledBinding SaveFileCommand}"
                     Data="{StaticResource SaveGeometry}"
-                    Foreground="{DynamicResource MainTextColor}"
-                    Height="45"
                     IconHeight="17"
                     IconWidth="17"
                     ToolTip.Tip="{CompiledBinding Save,
-                                                  Mode=OneWay}"
-                    Width="45" />
+                                                  Mode=OneWay}" />
 
                 <customControls:IconButton
-                    Background="Transparent"
-                    BorderBrush="{DynamicResource MainBorderColor}"
-                    BorderThickness="0,0,1,0"
                     Canvas.Left="180"
-                    Classes="hover"
+                    Classes="hover btn"
                     Command="{CompiledBinding CopyFileCommand}"
                     CommandParameter="{CompiledBinding FileInfo.FullName,
                                                        FallbackValue=''}"
                     Data="{StaticResource CopyGeometry}"
-                    Foreground="{DynamicResource MainTextColor}"
-                    Height="45"
                     IconHeight="17"
                     IconWidth="17"
-                    ToolTip.Tip="{CompiledBinding CopyFile}"
-                    Width="45" />
+                    ToolTip.Tip="{CompiledBinding CopyFile,
+                                                  Mode=OneWay}" />
 
                 <customControls:IconButton
-                    Background="Transparent"
-                    BorderBrush="{DynamicResource MainBorderColor}"
-                    BorderThickness="0,0,1,0"
                     Canvas.Left="225"
-                    Classes="hover"
+                    Classes="hover btn"
                     Command="{CompiledBinding DuplicateFileCommand}"
                     CommandParameter="{CompiledBinding FileInfo.FullName,
                                                        FallbackValue=''}"
                     Data="{StaticResource DuplicateGeometry}"
-                    Foreground="{DynamicResource MainTextColor}"
-                    Height="45"
                     IconHeight="17"
                     IconWidth="17"
                     ToolTip.Tip="{CompiledBinding DuplicateFile,
-                                                  Mode=OneWay}"
-                    Width="45" />
+                                                  Mode=OneWay}" />
 
                 <customControls:IconButton
-                    Background="Transparent"
-                    BorderBrush="{DynamicResource MainBorderColor}"
-                    BorderThickness="0,0,1,0"
                     Canvas.Left="270"
-                    Classes="hover"
+                    Classes="hover btn"
                     Command="{CompiledBinding CloseMenuCommand}"
                     CornerRadius="0,8,0,0"
                     Data="{StaticResource CloseGeometry}"
-                    Foreground="{DynamicResource MainTextColor}"
-                    Height="45"
                     IconHeight="10"
                     IconWidth="10"
                     ToolTip.Tip="{CompiledBinding Close,
-                                                  Mode=OneWay}"
-                    Width="45" />
+                                                  Mode=OneWay}" />
 
                 <Button
                     Background="{DynamicResource MenuButtonColor}"
@@ -167,13 +144,7 @@
                             Stretch="Fill"
                             VerticalAlignment="Center"
                             Width="21.39" />
-                        <TextBlock
-                            Classes="txt"
-                            Foreground="{DynamicResource MainTextColor}"
-                            MaxWidth="150"
-                            Text="{CompiledBinding Open,
-                                                   Mode=OneWay}"
-                            VerticalAlignment="Center" />
+                        <TextBlock Classes="txt btnTxt" Text="{CompiledBinding Open, Mode=OneWay}" />
                     </StackPanel>
                 </Button>
 
@@ -196,13 +167,7 @@
                             Stretch="Fill"
                             VerticalAlignment="Center"
                             Width="17" />
-                        <TextBlock
-                            Classes="txt"
-                            Foreground="{DynamicResource MainTextColor}"
-                            MaxWidth="150"
-                            Text="{CompiledBinding OpenWith,
-                                                   Mode=OneWay}"
-                            VerticalAlignment="Center" />
+                        <TextBlock Classes="txt btnTxt" Text="{CompiledBinding OpenWith, Mode=OneWay}" />
                     </StackPanel>
                 </Button>
 
@@ -225,13 +190,7 @@
                             Margin="11,0,9,0"
                             Stretch="Fill"
                             Width="19" />
-                        <TextBlock
-                            Classes="txt"
-                            Foreground="{DynamicResource MainTextColor}"
-                            MaxWidth="150"
-                            Text="{CompiledBinding ShowInFolder,
-                                                   Mode=OneWay}"
-                            VerticalAlignment="Center" />
+                        <TextBlock Classes="txt btnTxt" Text="{CompiledBinding ShowInFolder, Mode=OneWay}" />
                     </StackPanel>
                 </Button>
 
@@ -253,13 +212,7 @@
                             Stretch="Fill"
                             VerticalAlignment="Center"
                             Width="19" />
-                        <TextBlock
-                            Classes="txt"
-                            Foreground="{DynamicResource MainTextColor}"
-                            MaxWidth="150"
-                            Text="{CompiledBinding RenameFile,
-                                                   Mode=OneWay}"
-                            VerticalAlignment="Center" />
+                        <TextBlock Classes="txt btnTxt" Text="{CompiledBinding RenameFile, Mode=OneWay}" />
                     </StackPanel>
                 </Button>
 
@@ -281,13 +234,7 @@
                             Stretch="Fill"
                             VerticalAlignment="Center"
                             Width="19" />
-                        <TextBlock
-                            Classes="txt"
-                            Foreground="{DynamicResource MainTextColor}"
-                            MaxWidth="150"
-                            Text="{CompiledBinding FilePaste,
-                                                   Mode=OneWay}"
-                            VerticalAlignment="Center" />
+                        <TextBlock Classes="txt btnTxt" Text="{CompiledBinding FilePaste, Mode=OneWay}" />
                     </StackPanel>
                 </Button>
 
@@ -315,13 +262,7 @@
                                 </DrawingGroup>
                             </DrawingImage>
                         </Image>
-                        <TextBlock
-                            Classes="txt"
-                            Foreground="{DynamicResource MainTextColor}"
-                            MaxWidth="150"
-                            Text="{CompiledBinding NewWindow,
-                                                   Mode=OneWay}"
-                            VerticalAlignment="Center" />
+                        <TextBlock Classes="txt btnTxt" Text="{CompiledBinding NewWindow, Mode=OneWay}" />
                     </StackPanel>
                 </Button>
             </Canvas>

+ 14 - 17
src/PicView.Avalonia/Views/UC/Menus/ImageMenu.axaml

@@ -16,6 +16,15 @@
         <StackPanel.Resources>
             <SolidColorBrush Color="{DynamicResource MainTextColor}" x:Key="Brush0" />
         </StackPanel.Resources>
+        <StackPanel.Styles>
+            <Styles>
+                <Style Selector="TextBlock.btnTxt">
+                    <Setter Property="MaxWidth" Value="137" />
+                    <Setter Property="VerticalAlignment" Value="Center" />
+                    <Setter Property="Foreground" Value="{DynamicResource MainTextColor}" />
+                </Style>
+            </Styles>
+        </StackPanel.Styles>
 
         <Border
             Background="{DynamicResource MenuBackgroundColor}"
@@ -217,10 +226,8 @@
                             </Image>
                         </Canvas>
                         <TextBlock
-                            Classes="txt"
-                            Foreground="{DynamicResource MainTextColor}"
+                            Classes="txt btnTxt"
                             Margin="-3,0,0,0"
-                            MaxWidth="150"
                             Text="{CompiledBinding Resize,
                                                    Mode=OneWay}" />
                     </StackPanel>
@@ -243,12 +250,7 @@
                             Margin="9,0,9,0"
                             Stretch="Fill"
                             Width="17" />
-                        <TextBlock
-                            Classes="txt"
-                            Foreground="{DynamicResource MainTextColor}"
-                            MaxWidth="150"
-                            Text="{CompiledBinding Crop,
-                                                   Mode=OneWay}" />
+                        <TextBlock Classes="txt btnTxt" Text="{CompiledBinding Crop, Mode=OneWay}" />
                     </StackPanel>
                 </Button>
 
@@ -271,10 +273,8 @@
                             Source="{StaticResource SlideshowImage}"
                             Width="20" />
                         <TextBlock
-                            Classes="txt"
-                            Foreground="{DynamicResource MainTextColor}"
+                            Classes="txt btnTxt"
                             Margin="0,2,0,0"
-                            MaxWidth="150"
                             Text="{CompiledBinding Slideshow,
                                                    Mode=OneWay}" />
                     </StackPanel>
@@ -385,10 +385,8 @@
                     IsChecked="{CompiledBinding IsShowingSideBySide}"
                     ToolTip.Tip="{CompiledBinding SideBySideTooltip}">
                     <TextBlock
-                        Classes="txt"
-                        Foreground="{DynamicResource MainTextColor}"
+                        Classes="txt btnTxt"
                         Margin="1,0,6,0"
-                        MaxWidth="175"
                         Text="{CompiledBinding SideBySide}" />
                 </ToggleButton>
 
@@ -411,8 +409,7 @@
                             Source="{StaticResource GalleryImage}"
                             Width="20" />
                         <TextBlock
-                            Classes="txt"
-                            Foreground="{DynamicResource MainTextColor}"
+                            Classes="txt btnTxt"
                             Margin="10,0,6,0"
                             MaxWidth="175"
                             Text="{CompiledBinding GetIsShowingBottomGalleryTranslation,

+ 15 - 36
src/PicView.Avalonia/Views/UC/Menus/SettingsMenu.axaml

@@ -13,6 +13,15 @@
         <viewModels:MainViewModel />
     </Design.DataContext>
     <StackPanel>
+        <StackPanel.Styles>
+            <Styles>
+                <Style Selector="TextBlock.btnTxt">
+                    <Setter Property="MaxWidth" Value="137" />
+                    <Setter Property="VerticalAlignment" Value="Center" />
+                    <Setter Property="Foreground" Value="{DynamicResource MainTextColor}" />
+                </Style>
+            </Styles>
+        </StackPanel.Styles>
 
         <Border
             Background="{DynamicResource MenuBackgroundColor}"
@@ -121,12 +130,7 @@
                     ToolTip.Tip="{CompiledBinding ToggleScroll,
                                                   Mode=OneWay}"
                     Width="169">
-                    <TextBlock
-                        Classes="txt"
-                        Foreground="{DynamicResource MainTextColor}"
-                        MaxWidth="150"
-                        Text="{CompiledBinding GetIsScrollingTranslation,
-                                               Mode=OneWay}" />
+                    <TextBlock Classes="txt btnTxt" Text="{CompiledBinding GetIsScrollingTranslation, Mode=OneWay}" />
                 </ToggleButton>
 
                 <ToggleButton
@@ -140,12 +144,7 @@
                     ToolTip.Tip="{CompiledBinding Stretch,
                                                   Mode=OneWay}"
                     Width="169">
-                    <TextBlock
-                        Classes="txt"
-                        Foreground="{DynamicResource MainTextColor}"
-                        MaxWidth="150"
-                        Text="{CompiledBinding Stretch,
-                                               Mode=OneWay}" />
+                    <TextBlock Classes="txt btnTxt" Text="{CompiledBinding Stretch, Mode=OneWay}" />
                 </ToggleButton>
 
                 <ToggleButton
@@ -160,12 +159,7 @@
                     ToolTip.Tip="{CompiledBinding ToggleLooping,
                                                   Mode=OneWay}"
                     Width="169">
-                    <TextBlock
-                        Classes="txt"
-                        Foreground="{DynamicResource MainTextColor}"
-                        MaxWidth="150"
-                        Text="{CompiledBinding GetLooping,
-                                               Mode=OneWay}" />
+                    <TextBlock Classes="txt btnTxt" Text="{CompiledBinding GetIsLoopingTranslation, Mode=OneWay}" />
                 </ToggleButton>
 
                 <ToggleButton
@@ -180,12 +174,7 @@
                     ToolTip.Tip="{CompiledBinding AutoFitWindow,
                                                   Mode=OneWay}"
                     Width="169">
-                    <TextBlock
-                        Classes="txt"
-                        Foreground="{DynamicResource MainTextColor}"
-                        MaxWidth="150"
-                        Text="{CompiledBinding AutoFitWindow,
-                                               Mode=OneWay}" />
+                    <TextBlock Classes="txt btnTxt" Text="{CompiledBinding AutoFitWindow, Mode=OneWay}" />
                 </ToggleButton>
 
                 <ToggleButton
@@ -200,12 +189,7 @@
                     ToolTip.Tip="{CompiledBinding StayTopMost,
                                                   Mode=OneWay}"
                     Width="169">
-                    <TextBlock
-                        Classes="txt"
-                        Foreground="{DynamicResource MainTextColor}"
-                        MaxWidth="150"
-                        Text="{CompiledBinding StayTopMost,
-                                               Mode=OneWay}" />
+                    <TextBlock Classes="txt btnTxt" Text="{CompiledBinding StayTopMost, Mode=OneWay}" />
                 </ToggleButton>
 
                 <ToggleButton
@@ -220,12 +204,7 @@
                     ToolTip.Tip="{CompiledBinding SearchSubdirectory,
                                                   Mode=OneWay}"
                     Width="169">
-                    <TextBlock
-                        Classes="txt"
-                        Foreground="{DynamicResource MainTextColor}"
-                        MaxWidth="135"
-                        Text="{CompiledBinding SearchSubdirectory,
-                                               Mode=OneWay}" />
+                    <TextBlock Classes="txt btnTxt" Text="{CompiledBinding SearchSubdirectory, Mode=OneWay}" />
                 </ToggleButton>
             </Canvas>
         </Border>

+ 16 - 34
src/PicView.Avalonia/Views/UC/Menus/ToolsMenu.axaml

@@ -13,6 +13,15 @@
         <viewModels:MainViewModel />
     </Design.DataContext>
     <StackPanel>
+        <StackPanel.Styles>
+            <Styles>
+                <Style Selector="TextBlock.btnTxt">
+                    <Setter Property="MaxWidth" Value="137" />
+                    <Setter Property="VerticalAlignment" Value="Center" />
+                    <Setter Property="Foreground" Value="{DynamicResource MainTextColor}" />
+                </Style>
+            </Styles>
+        </StackPanel.Styles>
 
         <Border
             Background="{DynamicResource MenuBackgroundColor}"
@@ -129,12 +138,10 @@
                             Stretch="Fill"
                             Width="17" />
                         <TextBlock
-                            Classes="txt"
-                            Foreground="{DynamicResource MainTextColor}"
+                            Classes="txt btnTxt"
                             Margin="10,0,6,0"
                             Text="{CompiledBinding ImageInfo,
-                                                   Mode=OneWay}"
-                            VerticalAlignment="Center" />
+                                                   Mode=OneWay}" />
                     </StackPanel>
                 </Button>
 
@@ -154,12 +161,7 @@
                             Margin="9,0,10,0"
                             Source="{StaticResource PortalImage}"
                             Width="20" />
-                        <TextBlock
-                            Classes="txt"
-                            Foreground="{DynamicResource MainTextColor}"
-                            MaxWidth="150"
-                            Text="{CompiledBinding OptimizeImage,
-                                                   Mode=OneWay}" />
+                        <TextBlock Classes="txt btnTxt" Text="{CompiledBinding OptimizeImage, Mode=OneWay}" />
                     </StackPanel>
                 </Button>
 
@@ -181,12 +183,7 @@
                             Margin="9,0,12,0"
                             Stretch="Fill"
                             Width="17" />
-                        <TextBlock
-                            Classes="txt"
-                            Foreground="{DynamicResource MainTextColor}"
-                            MaxWidth="150"
-                            Text="{CompiledBinding ColorPickerTool,
-                                                   Mode=OneWay}" />
+                        <TextBlock Classes="txt btnTxt" Text="{CompiledBinding ColorPickerTool, Mode=OneWay}" />
                     </StackPanel>
                 </Button>
 
@@ -204,12 +201,7 @@
                             Margin="10,0,10,0"
                             Source="{StaticResource CanvasImage}"
                             Width="20" />
-                        <TextBlock
-                            Classes="txt"
-                            Foreground="{DynamicResource MainTextColor}"
-                            MaxWidth="150"
-                            Text="{CompiledBinding ChangeBackground,
-                                                   Mode=OneWay}" />
+                        <TextBlock Classes="txt btnTxt" Text="{CompiledBinding ChangeBackground, Mode=OneWay}" />
                     </StackPanel>
                 </Button>
 
@@ -229,12 +221,7 @@
                             Margin="9,0,12,0"
                             Source="{StaticResource ShortcutsImage}"
                             Width="17" />
-                        <TextBlock
-                            Classes="txt"
-                            Foreground="{DynamicResource MainTextColor}"
-                            MaxWidth="150"
-                            Text="{CompiledBinding ApplicationShortcuts,
-                                                   Mode=OneWay}" />
+                        <TextBlock Classes="txt btnTxt" Text="{CompiledBinding ApplicationShortcuts, Mode=OneWay}" />
                     </StackPanel>
                 </Button>
 
@@ -252,12 +239,7 @@
                             Margin="11,0,12,0"
                             Source="{StaticResource EyeOffImage}"
                             Width="18" />
-                        <TextBlock
-                            Classes="txt"
-                            Foreground="{DynamicResource MainTextColor}"
-                            MaxWidth="150"
-                            Text="{CompiledBinding GetIsShowingUITranslation,
-                                                   Mode=OneWay}" />
+                        <TextBlock Classes="txt btnTxt" Text="{CompiledBinding GetIsShowingUITranslation, Mode=OneWay}" />
                     </StackPanel>
                 </Button>
             </Canvas>