|
1 | 1 | <Styles xmlns="https://github.com/avaloniaui">
|
2 |
| - |
| 2 | + <Design.PreviewWith> |
| 3 | + <Border Padding="20"> |
| 4 | + <StackPanel Orientation="Vertical" Spacing="20" Width="350"> |
| 5 | + <Expander ExpandDirection="Up" Header="Expand Up" CornerRadius="25"> |
| 6 | + <Expander.Header> |
| 7 | + <Grid ColumnDefinitions="*, Auto"> |
| 8 | + <TextBlock Grid.Column="0" Text="Expand" /> |
| 9 | + <TextBlock Grid.Column="1" Text="Up" /> |
| 10 | + </Grid> |
| 11 | + </Expander.Header> |
| 12 | + <StackPanel> |
| 13 | + <TextBlock>Expanded content</TextBlock> |
| 14 | + </StackPanel> |
| 15 | + </Expander> |
| 16 | + <Expander ExpandDirection="Down" Header="Expand Down" CornerRadius="25"> |
| 17 | + <StackPanel> |
| 18 | + <TextBlock>Expanded content</TextBlock> |
| 19 | + </StackPanel> |
| 20 | + </Expander> |
| 21 | + <Expander ExpandDirection="Left" Header="Expand Left" CornerRadius="25"> |
| 22 | + <StackPanel> |
| 23 | + <TextBlock>Expanded content</TextBlock> |
| 24 | + </StackPanel> |
| 25 | + </Expander> |
| 26 | + <Expander ExpandDirection="Right" Header="Expand Right" CornerRadius="25"> |
| 27 | + <StackPanel> |
| 28 | + <TextBlock>Expanded content</TextBlock> |
| 29 | + </StackPanel> |
| 30 | + </Expander> |
| 31 | + </StackPanel> |
| 32 | + </Border> |
| 33 | + </Design.PreviewWith> |
3 | 34 | <Style Selector="Expander">
|
4 | 35 | <Setter Property="ContentTransition">
|
5 | 36 | <Setter.Value>
|
|
15 | 46 | BorderThickness="{TemplateBinding BorderThickness}"
|
16 | 47 | CornerRadius="{TemplateBinding CornerRadius}">
|
17 | 48 | <Grid RowDefinitions="Auto,*">
|
18 |
| - <ToggleButton Name="PART_toggle" Grid.Row="0" Content="{TemplateBinding Header}" IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}" /> |
| 49 | + <ToggleButton Name="PART_toggle" Grid.Row="0" |
| 50 | + HorizontalAlignment="{TemplateBinding HorizontalAlignment}" |
| 51 | + VerticalAlignment="{TemplateBinding VerticalAlignment}" |
| 52 | + Content="{TemplateBinding Header}" IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}" /> |
19 | 53 | <ContentPresenter Name="PART_ContentPresenter"
|
20 | 54 | Grid.Row="1"
|
21 | 55 | IsVisible="{TemplateBinding IsExpanded}"
|
|
37 | 71 | BorderThickness="{TemplateBinding BorderThickness}"
|
38 | 72 | CornerRadius="{TemplateBinding CornerRadius}">
|
39 | 73 | <Grid RowDefinitions="*,Auto">
|
40 |
| - <ToggleButton Name="PART_toggle" Grid.Row="1" Content="{TemplateBinding Header}" IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}" /> |
| 74 | + <ToggleButton Name="PART_toggle" Grid.Row="1" |
| 75 | + HorizontalAlignment="{TemplateBinding HorizontalAlignment}" |
| 76 | + VerticalAlignment="{TemplateBinding VerticalAlignment}" |
| 77 | + Content="{TemplateBinding Header}" IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}" /> |
41 | 78 | <ContentPresenter Name="PART_ContentPresenter"
|
42 | 79 | Grid.Row="0"
|
43 | 80 | IsVisible="{TemplateBinding IsExpanded}"
|
|
59 | 96 | BorderThickness="{TemplateBinding BorderThickness}"
|
60 | 97 | CornerRadius="{TemplateBinding CornerRadius}">
|
61 | 98 | <Grid ColumnDefinitions="Auto,*">
|
62 |
| - <ToggleButton Name="PART_toggle" Grid.Column="0" Content="{TemplateBinding Header}" IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}" /> |
| 99 | + <ToggleButton Name="PART_toggle" Grid.Column="0" |
| 100 | + HorizontalAlignment="{TemplateBinding HorizontalAlignment}" |
| 101 | + VerticalAlignment="{TemplateBinding VerticalAlignment}" |
| 102 | + Content="{TemplateBinding Header}" IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}" /> |
63 | 103 | <ContentPresenter Name="PART_ContentPresenter"
|
64 | 104 | Grid.Column="1"
|
65 | 105 | IsVisible="{TemplateBinding IsExpanded}"
|
|
81 | 121 | BorderThickness="{TemplateBinding BorderThickness}"
|
82 | 122 | CornerRadius="{TemplateBinding CornerRadius}">
|
83 | 123 | <Grid ColumnDefinitions="*,Auto">
|
84 |
| - <ToggleButton Name="PART_toggle" Grid.Column="1" Content="{TemplateBinding Header}" IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}" /> |
| 124 | + <ToggleButton Name="PART_toggle" Grid.Column="1" |
| 125 | + HorizontalAlignment="{TemplateBinding HorizontalAlignment}" |
| 126 | + VerticalAlignment="{TemplateBinding VerticalAlignment}" |
| 127 | + Content="{TemplateBinding Header}" IsChecked="{TemplateBinding IsExpanded, Mode=TwoWay}" /> |
85 | 128 | <ContentPresenter Name="PART_ContentPresenter"
|
86 | 129 | Grid.Column="0"
|
87 | 130 | IsVisible="{TemplateBinding IsExpanded}"
|
|
96 | 139 | </Setter>
|
97 | 140 | </Style>
|
98 | 141 | <Style Selector="Expander /template/ ToggleButton#PART_toggle">
|
| 142 | + <Setter Property="HorizontalContentAlignment" Value="Stretch" /> |
| 143 | + <Setter Property="Background" Value="Transparent" /> |
99 | 144 | <Setter Property="Template">
|
100 | 145 | <ControlTemplate>
|
101 |
| - <Border BorderThickness="1" Background="Transparent"> |
102 |
| - <Grid ColumnDefinitions="Auto,Auto"> |
| 146 | + <Border BorderThickness="1" Background="{TemplateBinding Background}"> |
| 147 | + <Grid ColumnDefinitions="Auto,*"> |
103 | 148 | <Border Grid.Column="0" Width="20" Height="20" HorizontalAlignment="Center" VerticalAlignment="Center">
|
104 | 149 | <Path Fill="{DynamicResource ThemeForegroundBrush}"
|
105 | 150 | HorizontalAlignment="Center"
|
|
0 commit comments