Skip to content

Commit 3b02ece

Browse files
committed
feat: add avalonia FlyoutPresenter style.
1 parent 3717325 commit 3b02ece

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<ResourceDictionary xmlns="https://github.com/avaloniaui"
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
x:ClassModifier="internal"
4+
xmlns:hc="https://handyorg.github.io/handycontrol">
5+
6+
<ControlTheme x:Key="{x:Type FlyoutPresenter}"
7+
TargetType="FlyoutPresenter">
8+
<Setter Property="HorizontalContentAlignment"
9+
Value="Stretch" />
10+
<Setter Property="VerticalContentAlignment"
11+
Value="Stretch" />
12+
<Setter Property="Background"
13+
Value="{DynamicResource RegionBrush}" />
14+
<Setter Property="BorderBrush"
15+
Value="{DynamicResource BorderBrush}" />
16+
<Setter Property="BorderThickness"
17+
Value="1" />
18+
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility"
19+
Value="Auto" />
20+
<Setter Property="ScrollViewer.VerticalScrollBarVisibility"
21+
Value="Auto" />
22+
<Setter Property="hc:BorderElement.CornerRadius"
23+
Value="{StaticResource DefaultCornerRadius}" />
24+
<Setter Property="CornerRadius"
25+
Value="{Binding $self.(hc:BorderElement.CornerRadius)}" />
26+
<Setter Property="Template">
27+
<ControlTemplate>
28+
<Border Effect="{StaticResource EffectShadow2}"
29+
Margin="8"
30+
Background="{TemplateBinding Background}"
31+
BorderBrush="{TemplateBinding BorderBrush}"
32+
BorderThickness="{TemplateBinding BorderThickness}"
33+
CornerRadius="{TemplateBinding CornerRadius}">
34+
<ScrollViewer HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
35+
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
36+
<ContentPresenter x:Name="PART_ContentPresenter"
37+
Margin="{TemplateBinding Padding}"
38+
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
39+
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
40+
HorizontalContentAlignment="Stretch"
41+
VerticalContentAlignment="Stretch"
42+
Content="{TemplateBinding Content}"
43+
ContentTemplate="{TemplateBinding ContentTemplate}" />
44+
</ScrollViewer>
45+
</Border>
46+
</ControlTemplate>
47+
</Setter>
48+
</ControlTheme>
49+
50+
</ResourceDictionary>

src/Avalonia/HandyControl_Avalonia/Themes/Styles/MergedStyles.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/AdornerLayer.axaml" />
1919
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/DataValidationErrors.axaml" />
20+
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/FlyoutPresenter.axaml" />
2021
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/MenuFlyoutPresenter.axaml" />
2122
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/TransitioningContentControl.axaml" />
2223
<MergeResourceInclude Source="avares://HandyControl/Themes/Styles/PopupRoot.axaml" />

0 commit comments

Comments
 (0)