Преглед изворни кода

主页按钮-UI,部分AI调整

liyijie пре 1 година
родитељ
комит
4961d4cbae
2 измењених фајлова са 58 додато и 12 уклоњено
  1. 42 0
      PDF Office/Styles/RadioButtonStyle.xaml
  2. 16 12
      PDF Office/Views/HomeContent.xaml

+ 42 - 0
PDF Office/Styles/RadioButtonStyle.xaml

@@ -762,4 +762,46 @@
             </Setter.Value>
         </Setter>
     </Style>
+
+    <Style x:Key="HomeContentLeftBtn" TargetType="{x:Type  RadioButton}">
+        <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" />
+        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
+        <Setter Property="BorderThickness" Value="0" />
+        <Setter Property="HorizontalContentAlignment" Value="Center" />
+        <Setter Property="VerticalContentAlignment" Value="Center" />
+        <Setter Property="Background" Value="Transparent" />
+        <Setter Property="BorderBrush" Value="Transparent" />
+        <Setter Property="IsTabStop" Value="False" />
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type  RadioButton}">
+                    <Border
+                        x:Name="border"
+                        CornerRadius="8"
+                        Background="{TemplateBinding Background}"
+                        BorderBrush="{TemplateBinding BorderBrush}"
+                        BorderThickness="{TemplateBinding BorderThickness}"
+                        SnapsToDevicePixels="true">
+                        <ContentPresenter
+                            x:Name="contentPresenter"
+                            Margin="{TemplateBinding Padding}"
+                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
+                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
+                            Focusable="False"
+                            RecognizesAccessKey="True"
+                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
+                    </Border>
+                    <ControlTemplate.Triggers>
+                    <Trigger Property="IsChecked" Value="true">
+                            <Setter TargetName="border" Property="Background" Value="{StaticResource color.item-state.sel.bg.lv1}" />
+                            <Setter Property="Foreground" Value="{StaticResource color.item-state.sel.bg.lv2}" />
+                    </Trigger>
+                        <Trigger Property="IsMouseOver" Value="True">
+                            <Setter TargetName="border" Property="Background" Value="{StaticResource color.item-state.sel.bg.lv2}" />
+                        </Trigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
 </ResourceDictionary>

+ 16 - 12
PDF Office/Views/HomeContent.xaml

@@ -58,14 +58,15 @@
         </Grid.ColumnDefinitions>
         <!--  左侧菜单栏  -->
         <StackPanel>
-            <Button
+            <RadioButton
                 x:Name="Home"
                 Height="64"
                 Margin="32,32,32,0"
                 Command="{Binding ShowToolCommand}"
                 CommandParameter="Guid"
                 Foreground="#FFFFFF"
-                Style="{StaticResource NoColorBtn}">
+                GroupName="home"
+                Style="{StaticResource HomeContentLeftBtn}">
                 
                 <StackPanel Orientation="Horizontal">
                     <Image
@@ -82,14 +83,15 @@
                         FontSize="16"
                         Text="Home" />
                 </StackPanel>
-            </Button>
-            <Button
+            </RadioButton>
+            <RadioButton
                 Height="64"
                 Margin="32,8,32,0"
                 Command="{Binding ShowToolCommand}"
                 CommandParameter="ChatGPTAITranslationContent"
                 Foreground="#FFFFFF"
-                Style="{StaticResource NoColorBtn}">
+                GroupName="home"
+                Style="{StaticResource HomeContentLeftBtn}">
                 <StackPanel Orientation="Horizontal">
                     <Image
                          Margin="0,0,8,0"
@@ -105,14 +107,15 @@
                         FontSize="16"
                         Text="AI Translation" />
                 </StackPanel>
-            </Button>
-            <Button
+            </RadioButton>
+            <RadioButton
                 Height="64"
                 Margin="32,8,32,0"
                 Command="{Binding ShowToolCommand}"
                 CommandParameter="ChatGPTAIRewritingContent"
                 Foreground="#FFFFFF"
-                Style="{StaticResource NoColorBtn}">
+                GroupName="home"
+                Style="{StaticResource HomeContentLeftBtn}">
                 <StackPanel Orientation="Horizontal">
                     <Image
                         Margin="0,0,8,0"
@@ -128,14 +131,15 @@
                         FontSize="16"
                         Text="AI Rewriting" />
                 </StackPanel>
-            </Button>
-            <Button
+            </RadioButton>
+            <RadioButton
                 Height="64"
                 Margin="32,8,32,0"
                 Command="{Binding ShowToolCommand}"
                 CommandParameter="ChatGPTAIErrorCorrectionContent"
                 Foreground="#FFFFFF"
-                Style="{StaticResource NoColorBtn}">
+                GroupName="home"
+                Style="{StaticResource HomeContentLeftBtn}">
                 <StackPanel Orientation="Horizontal">
                     <Image
                          Margin="0,0,8,0"
@@ -151,7 +155,7 @@
                         FontSize="16"
                         Text="AI Error Correction" />
                 </StackPanel>
-            </Button>
+            </RadioButton>
             <Button
                 Visibility="Collapsed"
                 x:Name="BtnOpenPDF"