Преглед на файлове

UI-补充Radiobutton 默认样式

ZhouJieSheng преди 2 години
родител
ревизия
c5577c2b80
променени са 1 файла, в които са добавени 78 реда и са изтрити 0 реда
  1. 78 0
      PDF Office/App.xaml

+ 78 - 0
PDF Office/App.xaml

@@ -744,6 +744,84 @@
                     </Trigger>
                 </Style.Triggers>
             </Style>
+
+            <!--  Design Token RadionButton  -->
+            <Style TargetType="{x:Type RadioButton}">
+                <Setter Property="FocusVisualStyle" Value="{x:Null}" />
+                <Setter Property="Background" Value="{StaticResource color.icon.checkbox-radio.norm.bg}" />
+                <Setter Property="BorderBrush" Value="{StaticResource color.icon.checkbox-radio.norm.border}" />
+                <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
+                <Setter Property="BorderThickness" Value="1" />
+                <Setter Property="Padding" Value="8,0,0,0" />
+                <Setter Property="Template">
+                    <Setter.Value>
+                        <ControlTemplate TargetType="{x:Type RadioButton}">
+                            <Grid
+                                x:Name="templateRoot"
+                                Background="Transparent"
+                                SnapsToDevicePixels="True">
+                                <Grid.ColumnDefinitions>
+                                    <ColumnDefinition Width="Auto" />
+                                    <ColumnDefinition Width="*" />
+                                </Grid.ColumnDefinitions>
+                                <Border
+                                    x:Name="radioButtonBorder"
+                                    Width="14"
+                                    Height="14"
+                                    HorizontalAlignment="Center"
+                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
+                                    Background="{TemplateBinding Background}"
+                                    BorderBrush="{TemplateBinding BorderBrush}"
+                                    BorderThickness="{TemplateBinding BorderThickness}"
+                                    CornerRadius="100">
+                                    <Grid x:Name="markGrid" Margin="1.8">
+                                        <Ellipse
+                                            x:Name="optionMark"
+                                            MinWidth="6"
+                                            MinHeight="6"
+                                            Fill="{StaticResource color.icon.checkbox-radio.sel.bg}"
+                                            Opacity="0" />
+                                    </Grid>
+                                </Border>
+                                <ContentPresenter
+                                    x:Name="contentPresenter"
+                                    Grid.Column="1"
+                                    Margin="{TemplateBinding Padding}"
+                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
+                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
+                                    Focusable="False"
+                                    RecognizesAccessKey="True"
+                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
+                            </Grid>
+                            <ControlTemplate.Triggers>
+                                <!--<Trigger Property="HasContent" Value="true">
+                                <Setter Property="Padding" Value="4,-1,0,0" />
+                            </Trigger>-->
+                                <Trigger Property="IsMouseOver" Value="true">
+                                    <Setter TargetName="radioButtonBorder" Property="BorderBrush" Value="{StaticResource color.icon.checkbox-radio.hov.border}" />
+                                </Trigger>
+                                <Trigger Property="IsEnabled" Value="false">
+                                    <Setter TargetName="radioButtonBorder" Property="Background" Value="{StaticResource color.icon.checkbox-radio.dis.bg}" />
+                                    <Setter TargetName="radioButtonBorder" Property="BorderBrush" Value="{StaticResource color.icon.checkbox-radio.dis.border}" />
+                                    <Setter TargetName="optionMark" Property="Fill" Value="{StaticResource color.icon.checkbox-radio.dis.fill}" />
+                                </Trigger>
+                                <!--<Trigger Property="IsPressed" Value="true">
+                                <Setter Property="Background" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.Pressed.Background2}"/>
+                                <Setter Property="BorderBrush" TargetName="radioButtonBorder" Value="{StaticResource RadioButton.Pressed.Border}"/>
+                                <Setter Property="Fill" TargetName="optionMark" Value="{StaticResource RadioButton.Pressed.Glyph2}"/>
+                            </Trigger>-->
+                                <Trigger Property="IsChecked" Value="true">
+                                    <Setter TargetName="optionMark" Property="Opacity" Value="1" />
+                                    <Setter TargetName="radioButtonBorder" Property="BorderBrush" Value="{StaticResource color.icon.checkbox-radio.hov.border}" />
+                                </Trigger>
+                                <Trigger Property="IsChecked" Value="{x:Null}">
+                                    <Setter TargetName="optionMark" Property="Opacity" Value="0.56" />
+                                </Trigger>
+                            </ControlTemplate.Triggers>
+                        </ControlTemplate>
+                    </Setter.Value>
+                </Setter>
+            </Style>
         </ResourceDictionary>
     </Application.Resources>
 </prism:PrismApplication>