<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="using:Sonex.Client.Controls"
    xmlns:tk="using:CommunityToolkit.WinUI.Controls">

    <Style x:Key="PropertyBoxItemsExpanderStyle" TargetType="controls:PropertyBoxItemsExpander">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:PropertyBoxItemsExpander">
                    <Expander
                        MaxWidth="1000"
                        HorizontalContentAlignment="Left"
                        HorizontalAlignment="Stretch"
                        Margin="6,6,6,6"
                        Background="{ThemeResource SolidBackgroundFillColorSenaryBrush}">
                        <Expander.Header>
                            <Grid Margin="0,0,0,0">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>

                                <ContentPresenter
                                    Grid.Column="0"
                                    Content="{TemplateBinding Icon}"
                                    VerticalAlignment="Center"
                                    Margin="0, 18, 18, 18" />

                                <StackPanel Grid.Column="1" Spacing="2" VerticalAlignment="Center">
                                    <TextBlock
                                        VerticalAlignment="Center"
                                        Text="{TemplateBinding Title}"
                                        Style="{ThemeResource BodyTextBlockStyle}"
                                        Foreground="{ThemeResource TextFillColorPrimaryBrush}" />

                                    <TextBlock
                                        VerticalAlignment="Center"
                                        Text="{TemplateBinding Description}"
                                        Style="{ThemeResource CaptionTextBlockStyle}"
                                        Foreground="{ThemeResource TextFillColorSecondaryBrush}"
                                        TextWrapping="Wrap" />
                                </StackPanel>
                            </Grid>
                        </Expander.Header>
                        <Expander.Content>
                            <StackPanel Orientation="Vertical">
                                <ItemsPresenter />
                                <ContentPresenter
                                    Content="{TemplateBinding Footer}"
                                    VerticalAlignment="Center"
                                    HorizontalAlignment="Left"
                                    Margin="0, 18, 0, 0" />
                            </StackPanel>
                        </Expander.Content>
                    </Expander>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <tk:WrapPanel
                        Orientation="Horizontal"
                        HorizontalSpacing="12"
                        VerticalSpacing="12" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
