CheckBox.axaml 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <Styles xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  3. <Style Selector="CheckBox.small">
  4. <Setter Property="Template">
  5. <ControlTemplate>
  6. <Grid x:Name="RootGrid" ColumnDefinitions="20,*">
  7. <Border x:Name="PART_Border"
  8. Grid.ColumnSpan="2"
  9. Background="{TemplateBinding Background}"
  10. BorderBrush="{TemplateBinding BorderBrush}"
  11. BorderThickness="{TemplateBinding BorderThickness}"
  12. CornerRadius="{TemplateBinding CornerRadius}" />
  13. <Grid VerticalAlignment="Top" Height="32">
  14. <Border x:Name="NormalRectangle"
  15. BorderBrush="{DynamicResource CheckBoxCheckBackgroundStrokeUnchecked}"
  16. Background="{DynamicResource CheckBoxCheckBackgroundFillUnchecked}"
  17. BorderThickness="{DynamicResource CheckBoxBorderThemeThickness}"
  18. CornerRadius="{TemplateBinding CornerRadius}"
  19. UseLayoutRounding="False"
  20. Height="{TemplateBinding Height}"
  21. Width="{TemplateBinding Height}" />
  22. <Viewbox UseLayoutRounding="False">
  23. <Panel>
  24. <Panel Height="16" Width="16" />
  25. <Path x:Name="CheckGlyph"
  26. Opacity="0"
  27. Fill="{DynamicResource CheckBoxCheckGlyphForegroundUnchecked}"
  28. Stretch="Uniform"
  29. VerticalAlignment="Center"
  30. FlowDirection="LeftToRight" />
  31. </Panel>
  32. </Viewbox>
  33. </Grid>
  34. <ContentPresenter x:Name="PART_ContentPresenter"
  35. ContentTemplate="{TemplateBinding ContentTemplate}"
  36. Content="{TemplateBinding Content}"
  37. Margin="{TemplateBinding Padding}"
  38. RecognizesAccessKey="True"
  39. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  40. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  41. TextWrapping="Wrap"
  42. Grid.Column="1" />
  43. </Grid>
  44. </ControlTemplate>
  45. </Setter>
  46. </Style>
  47. </Styles>