<?xml version="1.0" encoding="utf-8" ?>
<UserControl
    x:Class="Microsoft.PowerToys.Settings.UI.Controls.Card"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:local="using:Microsoft.PowerToys.Settings.UI.Controls"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    Padding="8"
    HorizontalContentAlignment="Stretch"
    VerticalContentAlignment="Stretch"
    Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
    BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}"
    BorderThickness="1"
    CornerRadius="{StaticResource OverlayCornerRadius}"
    mc:Ignorable="d">
    <Grid
        VerticalAlignment="{x:Bind VerticalContentAlignment, Mode=OneWay}"
        Background="{x:Bind Background, Mode=OneWay}"
        BorderBrush="{x:Bind BorderBrush, Mode=OneWay}"
        BorderThickness="{x:Bind BorderThickness, Mode=OneWay}"
        CornerRadius="{x:Bind CornerRadius, Mode=OneWay}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid x:Name="TitleGrid" MinHeight="44">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TextBlock
                Margin="16,0,0,0"
                VerticalAlignment="Center"
                AutomationProperties.HeadingLevel="Level2"
                FontSize="16"
                FontWeight="SemiBold"
                Text="{x:Bind Title, Mode=OneWay}" />
            <ContentPresenter
                Grid.Column="2"
                HorizontalAlignment="Right"
                VerticalAlignment="Center"
                Content="{x:Bind TitleContent, Mode=OneWay}" />
        </Grid>
        <Rectangle
            x:Name="Divider"
            Grid.Row="1"
            Height="1"
            HorizontalAlignment="Stretch"
            Fill="{ThemeResource DividerStrokeColorDefaultBrush}"
            Visibility="{x:Bind DividerVisibility, Mode=OneWay}" />

        <ContentPresenter
            Grid.Row="2"
            Margin="{x:Bind Padding, Mode=OneWay}"
            HorizontalAlignment="{x:Bind HorizontalContentAlignment, Mode=OneWay}"
            VerticalAlignment="{x:Bind VerticalContentAlignment, Mode=OneWay}"
            Content="{x:Bind Content, Mode=OneWay}" />
        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="TitleGridVisibilityStates">
                <VisualState x:Name="TitleGridVisible" />
                <VisualState x:Name="TitleGridCollapsed">
                    <VisualState.Setters>
                        <Setter Target="TitleGrid.Visibility" Value="Collapsed" />
                    </VisualState.Setters>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</UserControl>
