Merge pull request #183 from irihitech/159-lightflyout

feat: add LightFlyout theme.
This commit is contained in:
Dong Bin 2023-05-09 20:54:54 +08:00 committed by GitHub
commit 66e1bf1439
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 84 additions and 2 deletions

View File

@ -16,7 +16,7 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
ColumnDefinitions="*, *, *, *, *"
RowDefinitions="*, *, *, *, *">
RowDefinitions="*, *, *, *, *, *">
<Button
Grid.Row="0"
Grid.Column="1"
@ -113,6 +113,44 @@
<Flyout Content="BottomEdgeAlignedRight" Placement="BottomEdgeAlignedRight" />
</Button.Flyout>
</Button>
<Button
Grid.Row="2"
Grid.Column="2"
Content="Center">
<Button.Flyout>
<Flyout Content="Center" Placement="Center" />
</Button.Flyout>
</Button>
<Button
Grid.Row="5"
Grid.Column="2" Content="LightFlyout">
<Button.Flyout>
<Flyout FlyoutPresenterTheme="{StaticResource LightFlyout}" Placement="Top">
<StackPanel>
<Label Classes="Amber" Theme="{StaticResource TagLabel}">Amber</Label>
<Label Classes="Blue" Theme="{StaticResource TagLabel}">Blue</Label>
<Label Classes="Cyan" Theme="{StaticResource TagLabel}">Cyan</Label>
<Label Classes="Green" Theme="{StaticResource TagLabel}">Green</Label>
<Label Classes="Grey" Theme="{StaticResource TagLabel}">Grey</Label>
<Label Classes="Indigo" Theme="{StaticResource TagLabel}">Indigo</Label>
<Label Classes="LightBlue" Theme="{StaticResource TagLabel}">LightBlue</Label>
<Label Classes="LightGreen" Theme="{StaticResource TagLabel}">LightGreen</Label>
<Label Classes="Lime" Theme="{StaticResource TagLabel}">Lime</Label>
<Label Classes="Orange" Theme="{StaticResource TagLabel}">Orange</Label>
<Label Classes="Pink" Theme="{StaticResource TagLabel}">Pink</Label>
<Label Classes="Purple" Theme="{StaticResource TagLabel}">Purple</Label>
<Label Classes="Red" Theme="{StaticResource TagLabel}">Red</Label>
<Label Classes="Teal" Theme="{StaticResource TagLabel}">Teal</Label>
<Label Classes="Violet" Theme="{StaticResource TagLabel}">Violet</Label>
<Label Classes="Yellow" Theme="{StaticResource TagLabel}">Yellow</Label>
<Label Classes="White" Theme="{StaticResource TagLabel}">White</Label>
</StackPanel>
</Flyout>
</Button.Flyout>
</Button>
</Grid>
</UserControl>
</UserControl>

View File

@ -46,4 +46,48 @@
</ControlTemplate>
</Setter>
</ControlTheme>
<ControlTheme x:Key="LightFlyout" TargetType="FlyoutPresenter">
<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="Transparent" />
<Setter Property="FlyoutPresenter.BorderBrush" Value="Transparent" />
<Setter Property="FlyoutPresenter.BorderThickness" Value="0" />
<Setter Property="FlyoutPresenter.Padding" Value="{DynamicResource FlyoutPadding}" />
<Setter Property="FlyoutPresenter.MinWidth" Value="{DynamicResource FlyoutMinWidth}" />
<Setter Property="FlyoutPresenter.MaxWidth" Value="{DynamicResource FlyoutMaxWidth}" />
<Setter Property="FlyoutPresenter.MinHeight" Value="{DynamicResource FlyoutMinHeight}" />
<Setter Property="FlyoutPresenter.MaxHeight" Value="{DynamicResource FlyoutMaxHeight}" />
<Setter Property="FlyoutPresenter.Foreground" Value="{DynamicResource FlyoutForeground}" />
<Setter Property="FlyoutPresenter.ClipToBounds" Value="False" />
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
<Setter Property="FlyoutPresenter.CornerRadius" Value="{DynamicResource FlyoutCornerRadius}" />
<Setter Property="FlyoutPresenter.Margin" Value="4" />
<Setter Property="FlyoutPresenter.Template">
<ControlTemplate TargetType="FlyoutPresenter">
<Border
Name="LayoutRoot"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
ClipToBounds="False"
CornerRadius="{TemplateBinding CornerRadius}"
UseLayoutRounding="False">
<ScrollViewer HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
<ContentPresenter
Margin="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}" />
</ScrollViewer>
</Border>
</ControlTemplate>
</Setter>
</ControlTheme>
</ResourceDictionary>