<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 TargetType="controls:PropertyBoxContentExpander">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:PropertyBoxContentExpander">

                    <Expander MaxWidth="1000" HorizontalContentAlignment="Stretch" HorizontalAlignment="Stretch" Margin="6,6,6,6" Background="{ThemeResource SolidBackgroundFillColorSenaryBrush}" VerticalContentAlignment="Top">
                        <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>
                            <Grid HorizontalAlignment="Stretch">
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="auto"></RowDefinition>
                                    <RowDefinition Height="auto"></RowDefinition>
                                </Grid.RowDefinitions>
                                <ContentPresenter Grid.Row="0"
                                Content="{TemplateBinding Body}"
                                HorizontalAlignment="Stretch"
                                Margin="0, 0, 0, 0"
                                                  Padding="0 0 0 0"/>
                                <ContentPresenter Grid.Row="1"
                                Content="{TemplateBinding Footer}"
                                VerticalAlignment="Center"
                                HorizontalAlignment="Left"
                                Margin="0, 18, 0, 0" />
                            </Grid>
                        </Expander.Content>
                    </Expander>

                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style 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>

    <Style TargetType="controls:PropertyBox">
        <Setter Property="HorizontalContentAlignment" Value="Stretch" />
        <Setter Property="VerticalContentAlignment" Value="Top" />
        <Setter Property="Padding" Value="16" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:PropertyBox">
                    <Border
                        Padding="18 0 9 0"
                        Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
                        BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
                        BorderThickness="1"
                        MaxWidth="1000" HorizontalAlignment="Stretch" Margin="6,6,6,6"
                        CornerRadius="4">


                        <Grid Margin="0,0,0,0" >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>

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

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

                                <TextBlock VerticalAlignment="Center"
                                           Margin="0 0 0 9"
                                    Text="{TemplateBinding Description}"
                                    Style="{ThemeResource CaptionTextBlockStyle}"
                                    Foreground="{ThemeResource TextFillColorSecondaryBrush}"
                                    TextWrapping="Wrap" />
                            </StackPanel>
                            <ContentPresenter
                                Grid.Column="2"
                                Content="{TemplateBinding Content}"
                                Margin="8 0 0 0" />
                        </Grid>
                        
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
