<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ui="http://schemas.modernwpf.com/2019"
    xmlns:local="clr-namespace:ModernWpf.Controls">

    <Thickness x:Key="FlyoutContentPadding">16,15,16,17</Thickness>

    <Style TargetType="local:FlyoutPresenter">
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="IsTabStop" Value="False" />
        <Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" />
        <Setter Property="FontWeight" Value="Normal" />
        <Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
        <Setter Property="Background" Value="{DynamicResource FlyoutPresenterBackground}" />
        <Setter Property="Foreground" Value="{DynamicResource SystemControlForegroundBaseHighBrush}" />
        <Setter Property="BorderBrush" Value="{DynamicResource FlyoutBorderThemeBrush}" />
        <Setter Property="BorderThickness" Value="{DynamicResource FlyoutBorderThemeThickness}" />
        <Setter Property="Padding" Value="{StaticResource FlyoutContentPadding}" />
        <Setter Property="MinWidth" Value="{DynamicResource FlyoutThemeMinWidth}" />
        <Setter Property="MaxWidth" Value="{DynamicResource FlyoutThemeMaxWidth}" />
        <Setter Property="MinHeight" Value="{DynamicResource FlyoutThemeMinHeight}" />
        <Setter Property="MaxHeight" Value="{DynamicResource FlyoutThemeMaxHeight}" />
        <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
        <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
        <Setter Property="CornerRadius" Value="{DynamicResource OverlayCornerRadius}" />
        <Setter Property="IsDefaultShadowEnabled" Value="{DynamicResource {x:Static SystemParameters.DropShadowKey}}" />
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:FlyoutPresenter">
                    <ui:ThemeShadowChrome
                        IsShadowEnabled="{TemplateBinding IsDefaultShadowEnabled}"
                        CornerRadius="{TemplateBinding CornerRadius}"
                        SnapsToDevicePixels="True">
                        <Border
                            x:Name="LayoutRoot"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            CornerRadius="{TemplateBinding CornerRadius}">
                            <ScrollViewer
                                x:Name="ScrollViewer"
                                HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
                                VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
                                <ContentPresenter
                                    Margin="{TemplateBinding Padding}"
                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                    SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                            </ScrollViewer>
                        </Border>
                    </ui:ThemeShadowChrome>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>