Browse Source

add initial port of checkbox template.

pull/4012/head
Dan Walmsley 6 years ago
parent
commit
91caa45132
  1. 89
      src/Avalonia.Themes.Fluent/CheckBox.xaml

89
src/Avalonia.Themes.Fluent/CheckBox.xaml

@ -1,50 +1,53 @@
<Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style Selector="CheckBox"> <Style Selector="CheckBox">
<Setter Property="Foreground" Value="{DynamicResource ThemeForegroundBrush}"/> <Setter Property="Background" Value="{DynamicResource CheckBoxBackgroundUnchecked}" />
<Setter Property="Background" Value="Transparent"/> <Setter Property="Foreground" Value="{DynamicResource CheckBoxForegroundUnchecked}" />
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource CheckBoxBorderBrushUnchecked}" />
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/> <Setter Property="Padding" Value="8,5,0,0" />
<Setter Property="Padding" Value="4,0,0,0"/> <Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Left"/> <Setter Property="HorizontalContentAlignment" Value="Left" />
<Setter Property="VerticalContentAlignment" Value="Top" />
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" />
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
<Setter Property="MinWidth" Value="120" />
<Setter Property="MinHeight" Value="32" />
<!--<Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}" />
<Setter Property="FocusVisualMargin" Value="-7,-3,-7,-3" />-->
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Grid ColumnDefinitions="Auto,*"> <Border Background="{TemplateBinding Background}"
<Border Name="border" BorderBrush="{TemplateBinding BorderBrush}"
Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="{DynamicResource ControlCornerRadius}">
BorderThickness="{TemplateBinding BorderThickness}" <Grid x:Name="RootGrid" ColumnDefinitions="20,*">
Width="18" <Grid VerticalAlignment="Top" Height="32">
Height="18" <Border x:Name="NormalRectangle"
VerticalAlignment="Center"> Background="{DynamicResource CheckBoxCheckBackgroundFillUnchecked}"
<Panel> BorderBrush="{DynamicResource CheckBoxCheckBackgroundStrokeUnchecked}"
<Path Name="checkMark" BorderThickness="{DynamicResource CheckBoxBorderThemeThickness}"
Fill="{DynamicResource HighlightBrush}" UseLayoutRounding="False"
Width="11" Height="20"
Height="10" Width="20"
Stretch="Uniform" CornerRadius="{DynamicResource ControlCornerRadius}" />
HorizontalAlignment="Center" <!--<FontIcon x:Name="CheckGlyph"
VerticalAlignment="Center" FontFamily="{DynamicResource SymbolThemeFontFamily}"
Data="M 1145.607177734375,430 C1145.607177734375,430 1141.449951171875,435.0772705078125 1141.449951171875,435.0772705078125 1141.449951171875,435.0772705078125 1139.232177734375,433.0999755859375 1139.232177734375,433.0999755859375 1139.232177734375,433.0999755859375 1138,434.5538330078125 1138,434.5538330078125 1138,434.5538330078125 1141.482177734375,438 1141.482177734375,438 1141.482177734375,438 1141.96875,437.9375 1141.96875,437.9375 1141.96875,437.9375 1147,431.34619140625 1147,431.34619140625 1147,431.34619140625 1145.607177734375,430 1145.607177734375,430 z"/> Glyph="&#xE001;"
<Rectangle Name="indeterminateMark" FontSize="16"
Fill="{DynamicResource HighlightBrush}" Foreground="{DynamicResource CheckBoxCheckGlyphForegroundUnchecked}"
Width="10" Opacity="0" />-->
Height="10"
Stretch="Uniform" </Grid>
HorizontalAlignment="Center" <ContentPresenter x:Name="ContentPresenter"
VerticalAlignment="Center"/> ContentTemplate="{TemplateBinding ContentTemplate}"
</Panel> Content="{TemplateBinding Content}"
</Border> Margin="{TemplateBinding Padding}"
<ContentPresenter Name="PART_ContentPresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
TextBlock.Foreground="{TemplateBinding Foreground}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
ContentTemplate="{TemplateBinding ContentTemplate}" Grid.Column="1" />
Content="{TemplateBinding Content}" <!-- TODO: TextWrapping="Wrap" on contentpresenter -->
Margin="{TemplateBinding Padding}" </Grid>
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" </Border>
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
IsVisible="{TemplateBinding Content, Converter={x:Static ObjectConverters.IsNotNull}}"
Grid.Column="1"/>
</Grid>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> </Style>

Loading…
Cancel
Save