11<ResourceDictionary xmlns =" https://github.com/avaloniaui" xmlns : x =" http://schemas.microsoft.com/winfx/2006/xaml" >
2- <ControlTheme x : Key =" ButtonToggleSwitch" TargetType =" ToggleSwitch" >
3- <Setter Property =" HorizontalAlignment" Value =" Center" />
4- <Setter Property =" VerticalAlignment" Value =" Center" />
5- <Setter Property =" HorizontalContentAlignment" Value =" Center" />
6- <Setter Property =" VerticalContentAlignment" Value =" Center" />
7- <Setter Property =" Padding" Value =" {DynamicResource ButtonDefaultPadding}" />
8- <Setter Property =" Background" Value =" Transparent" />
9- <Setter Property =" BackgroundSizing" Value =" OuterBorderEdge" />
10- <Setter Property =" BorderBrush" Value =" {DynamicResource ButtonDefaultBorderBrush}" />
11- <Setter Property =" BorderThickness" Value =" {DynamicResource ButtonBorderThickness}" />
12- <Setter Property =" CornerRadius" Value =" {DynamicResource ButtonCornerRadius}" />
13- <Setter Property =" Cursor" Value =" Hand" />
14- <Setter Property =" OnContent" Value =" {x:Null}" />
15- <Setter Property =" OffContent" Value =" {x:Null}" />
16- <Setter Property =" Content" Value =" {x:Null}" />
17- <Setter Property =" MinHeight" Value =" {DynamicResource ButtonDefaultHeight}" />
18- <Setter Property =" FontSize" Value =" {DynamicResource ButtonDefaultFontSize}" />
19- <Setter Property =" FontWeight" Value =" {DynamicResource ButtonDefaultFontWeight}" />
20- <Setter Property =" Template" >
21- <ControlTemplate TargetType =" ToggleSwitch" >
22- <Border
23- Name =" Background"
24- Padding =" {TemplateBinding Padding}"
25- Background =" {TemplateBinding Background}"
26- BorderBrush =" {TemplateBinding BorderBrush}"
27- BorderThickness =" {TemplateBinding BorderThickness}"
28- CornerRadius =" {TemplateBinding CornerRadius}" >
29- <Panel >
30- <Panel Name =" PART_SwitchKnob" />
31- <Panel Name =" PART_MovingKnobs" />
32- <ContentPresenter
33- Name =" PART_OnContentPresenter"
34- IsVisible =" {TemplateBinding IsChecked}"
35- Content =" {TemplateBinding OnContent}"
36- ContentTemplate =" {TemplateBinding OnContentTemplate}" />
37- <ContentPresenter
38- Name =" PART_OffContentPresenter"
39- IsVisible =" {TemplateBinding IsChecked, Converter={x:Static BoolConverters.Not}}"
40- Content =" {TemplateBinding OffContent}"
41- ContentTemplate =" {TemplateBinding OffContentTemplate}" />
42- <ContentPresenter
43- Name =" PART_ContentPresenter"
44- Content =" {TemplateBinding Content}"
45- ContentTemplate =" {TemplateBinding ContentTemplate}" >
46- <ContentPresenter .IsVisible>
47- <MultiBinding Converter =" {x:Static BoolConverters.And}" >
48- <TemplateBinding Property =" Content" Converter =" {x:Static ObjectConverters.IsNotNull}" />
49- <TemplateBinding Property =" OnContent" Converter =" {x:Static ObjectConverters.IsNull}" />
50- <TemplateBinding Property =" OffContent" Converter =" {x:Static ObjectConverters.IsNull}" />
51- </MultiBinding >
52- </ContentPresenter .IsVisible>
53- </ContentPresenter >
54- </Panel >
55- </Border >
56- </ControlTemplate >
2+ <ControlTheme x : Key =" IconBorderlessToggleSwitch"
3+ BasedOn =" {StaticResource ButtonToggleSwitch}"
4+ TargetType =" ToggleSwitch" >
5+ <Setter Property =" Padding" Value =" {StaticResource SemiThicknessTight}" />
6+ <Setter Property =" Width" Value =" {StaticResource SemiSpacingExtraLoose}" />
7+ <Setter Property =" Height" Value =" {StaticResource SemiSpacingExtraLoose}" />
8+ <Setter Property =" Foreground" Value =" {DynamicResource SemiColorText1}" />
9+ <Setter Property =" OnContentTemplate" >
10+ <StaticResource ResourceKey =" GeometryDataTemplate" />
5711 </Setter >
12+ <Setter Property =" OffContentTemplate" >
13+ <StaticResource ResourceKey =" GeometryDataTemplate" />
14+ </Setter >
15+ <Setter Property =" ContentTemplate" >
16+ <StaticResource ResourceKey =" GeometryDataTemplate" />
17+ </Setter >
18+ </ControlTheme >
5819
59- <Style Selector =" ^:pressed" >
60- <Setter Property =" RenderTransform" Value =" scale(0.98)" />
61- </Style >
62-
63- <Style Selector =" ^ /template/ Border#Background" >
64- <Setter Property =" BorderBrush" Value =" {TemplateBinding BorderBrush}" />
65- <Setter Property =" Background" Value =" {TemplateBinding Background}" />
66- </Style >
67-
68- <Style Selector =" ^:pointerover /template/ Border#Background" >
69- <Setter Property =" BorderBrush" Value =" {DynamicResource ButtonDefaultPointeroverBorderBrush}" />
70- <Setter Property =" Background" Value =" {DynamicResource ButtonDefaultPointeroverBackground}" />
71- </Style >
72-
73- <Style Selector =" ^:pressed /template/ Border#Background" >
74- <Setter Property =" BorderBrush" Value =" {DynamicResource ButtonDefaultPressedBorderBrush}" />
75- <Setter Property =" Background" Value =" {DynamicResource ButtonDefaultPressedBackground}" />
76- </Style >
77-
78- <Style Selector =" ^:disabled /template/ Border#Background" >
79- <Setter Property =" BorderBrush" Value =" {DynamicResource ButtonDefaultDisabledBorderBrush}" />
80- </Style >
81-
82- <Style Selector =" ^:disabled" >
83- <Style Selector =" ^ /template/ ContentPresenter#PART_ContentPresenter" >
84- <Setter Property =" Foreground" Value =" {DynamicResource ButtonDefaultDisabledForeground}" />
85- </Style >
86- <Style Selector =" ^ /template/ ContentPresenter#PART_OnContentPresenter" >
87- <Setter Property =" Foreground" Value =" {DynamicResource ButtonDefaultDisabledForeground}" />
88- </Style >
89- <Style Selector =" ^ /template/ ContentPresenter#PART_OffContentPresenter" >
90- <Setter Property =" Foreground" Value =" {DynamicResource ButtonDefaultDisabledForeground}" />
91- </Style >
92- </Style >
93-
94- <Style Selector =" ^.Large" >
95- <Setter Property =" MinHeight" Value =" {DynamicResource ButtonLargeHeight}" />
96- <Setter Property =" Padding" Value =" {DynamicResource ButtonLargePadding}" />
97- </Style >
98- <Style Selector =" ^.Small" >
99- <Setter Property =" MinHeight" Value =" {DynamicResource ButtonSmallHeight}" />
100- <Setter Property =" Padding" Value =" {DynamicResource ButtonSmallPadding}" />
101- </Style >
102-
103- <Style Selector =" ^ /template/ Border#Background" >
104- <Setter Property =" BorderBrush" Value =" {DynamicResource ButtonBorderlessBorderBrush}" />
105- <Setter Property =" Background" Value =" {DynamicResource ButtonBorderlessBackground}" />
106- </Style >
107- <Style Selector =" ^:disabled /template/ Border#Background" >
108- <Setter Property =" BorderBrush" Value =" {DynamicResource ButtonBorderlessBorderBrush}" />
109- <Setter Property =" Background" Value =" {DynamicResource ButtonBorderlessBackground}" />
110- <!-- <Setter Property="Foreground" Value="{DynamicResource ButtonDefaultDisabledForeground}" /> -->
111- </Style >
20+ <ControlTheme x : Key =" IconBorderlessButton"
21+ BasedOn =" {StaticResource BorderlessButton}"
22+ TargetType =" Button" >
23+ <Setter Property =" Padding" Value =" {StaticResource SemiThicknessTight}" />
24+ <Setter Property =" Width" Value =" {StaticResource SemiSpacingExtraLoose}" />
25+ <Setter Property =" Height" Value =" {StaticResource SemiSpacingExtraLoose}" />
26+ <Setter Property =" Foreground" Value =" {DynamicResource SemiColorText1}" />
27+ <Setter Property =" ContentTemplate" >
28+ <StaticResource ResourceKey =" GeometryDataTemplate" />
29+ </Setter >
11230 </ControlTheme >
31+
32+ <DataTemplate x : Key =" GeometryDataTemplate" DataType =" Geometry" >
33+ <PathIcon Theme =" {StaticResource InnerPathIcon}" Data =" {Binding}" />
34+ </DataTemplate >
11335</ResourceDictionary >
0 commit comments