feat: set flyout default font weight, add more demos.

This commit is contained in:
rabbitism 2022-12-24 14:59:42 +08:00
parent 06ab6cd7d5
commit d3ca12854e
3 changed files with 107 additions and 14 deletions

View File

@ -7,17 +7,107 @@
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<StackPanel>
<StackPanel>
<Button Content="Hello">
<Button.Flyout>
<Flyout Placement="Top" ShowMode="Standard">
<StackPanel>
<TextBlock>Hello World</TextBlock>
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
</StackPanel>
</StackPanel>
<Grid
HorizontalAlignment="Center"
VerticalAlignment="Center"
ColumnDefinitions="* * * * *"
RowDefinitions="* * * * *">
<Button
Grid.Row="0"
Grid.Column="1"
Content="Top Left">
<Button.Flyout>
<Flyout Content="TopEdgeAlignedLeft" Placement="TopEdgeAlignedLeft" />
</Button.Flyout>
</Button>
<Button
Grid.Row="0"
Grid.Column="2"
Content="Top">
<Button.Flyout>
<Flyout Content="Top" Placement="Top" />
</Button.Flyout>
</Button>
<Button
Grid.Row="0"
Grid.Column="3"
Content="Top Right">
<Button.Flyout>
<Flyout Content="TopEdgeAlignedRight" Placement="TopEdgeAlignedRight" />
</Button.Flyout>
</Button>
<Button
Grid.Row="1"
Grid.Column="0"
Content="Left Top">
<Button.Flyout>
<Flyout Content="LeftEdgeAlignedTop" Placement="LeftEdgeAlignedTop" />
</Button.Flyout>
</Button>
<Button
Grid.Row="1"
Grid.Column="4"
Content="Right Top">
<Button.Flyout>
<Flyout Content="RightEdgeAlignedTop" Placement="RightEdgeAlignedTop" />
</Button.Flyout>
</Button>
<Button
Grid.Row="2"
Grid.Column="0"
Content="Left">
<Button.Flyout>
<Flyout Content="Left" Placement="Left" />
</Button.Flyout>
</Button>
<Button
Grid.Row="2"
Grid.Column="4"
Content="Right">
<Button.Flyout>
<Flyout Content="Right" Placement="Right" />
</Button.Flyout>
</Button>
<Button
Grid.Row="3"
Grid.Column="0"
Content="Left Bottom">
<Button.Flyout>
<Flyout Content="LeftEdgeAlignedBottom" Placement="LeftEdgeAlignedBottom" />
</Button.Flyout>
</Button>
<Button
Grid.Row="3"
Grid.Column="4"
Content="Right Bottom">
<Button.Flyout>
<Flyout Content="RightEdgeAlignedBottom" Placement="RightEdgeAlignedBottom" />
</Button.Flyout>
</Button>
<Button
Grid.Row="4"
Grid.Column="1"
Content="Bottom Left">
<Button.Flyout>
<Flyout Content="BottomEdgeAlignedLeft" Placement="BottomEdgeAlignedLeft" />
</Button.Flyout>
</Button>
<Button
Grid.Row="4"
Grid.Column="2"
Content="Bottom">
<Button.Flyout>
<Flyout Content="Bottom" Placement="Bottom" />
</Button.Flyout>
</Button>
<Button
Grid.Row="4"
Grid.Column="3"
Content="Bottom Right">
<Button.Flyout>
<Flyout Content="BottomEdgeAlignedRight" Placement="BottomEdgeAlignedRight" />
</Button.Flyout>
</Button>
</Grid>
</UserControl>

View File

@ -3,6 +3,7 @@
<Setter Property="FlyoutPresenter.HorizontalContentAlignment" Value="Stretch" />
<Setter Property="FlyoutPresenter.VerticalContentAlignment" Value="Stretch" />
<Setter Property="FlyoutPresenter.UseLayoutRounding" Value="False" />
<Setter Property="FlyoutPresenter.FontWeight" Value="{DynamicResource FlyoutFontWeight}" />
<Setter Property="FlyoutPresenter.Background" Value="{DynamicResource FlyoutBackground}" />
<Setter Property="FlyoutPresenter.BorderBrush" Value="{DynamicResource FlyoutBorderBrush}" />
<Setter Property="FlyoutPresenter.BorderThickness" Value="{DynamicResource FlyoutBorderThickness}" />
@ -35,7 +36,8 @@
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}" />
ContentTemplate="{TemplateBinding ContentTemplate}"
FontWeight="{TemplateBinding FontWeight}" />
</ScrollViewer>
</Border>
</ControlTemplate>

View File

@ -7,6 +7,7 @@
x:Key="FlyoutBorderBrush"
Opacity="0.08"
Color="#1C1F23" />
<FontWeight x:Key="FlyoutFontWeight">400</FontWeight>
<Thickness x:Key="FlyoutBorderThickness">1</Thickness>
<BoxShadows x:Key="FlyoutBorderBoxShadow">0 0 8 0 #1A000000</BoxShadows>
<sys:Double x:Key="FlyoutMinHeight">100</sys:Double>