<UserControl x:Class="CustomControls.BackgroudBox"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:conv ="clr-namespace:Converters"
             xmlns:local="clr-namespace:CustomControls"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    
    
    <UserControl.Resources>

        <conv:EnumToStringConverter x:Key="EnumToString"/>

        <!--Header label style-->
        <Style x:Key="HeaderStyle" TargetType="{x:Type Label}" BasedOn="{StaticResource {x:Type Label}}">
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="Foreground" Value="#FF809595"/>
            <Style.Triggers>
                <Trigger Property="HorizontalContentAlignment" Value="Left">
                    <Setter Property="Padding" Value="20,0,0,0"/>
                </Trigger>
                <Trigger Property="HorizontalContentAlignment" Value="Right">
                    <Setter Property="Padding" Value="0,0,20,0"/>
                </Trigger>
                <Trigger Property="HorizontalContentAlignment" Value="Center">
                    <Setter Property="Padding" Value="0,0,0,0"/>
                </Trigger>
            </Style.Triggers>
        </Style>



    </UserControl.Resources>



    <Grid x:Name="LayoutRoot">
        <Grid.OpacityMask>
            <VisualBrush Visual="{Binding ElementName=Border1}" />
        </Grid.OpacityMask>

        <Border x:Name="Border1" CornerRadius="7" BorderBrush="#FFCCCCCC" BorderThickness="1" Width="{Binding ElementName=LayoutRoot, Path=ActualWidth}" Height="{Binding ElementName=LayoutRoot, Path=ActualHeight}" >
            <Border.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFF5F5F5" Offset="0.324"/>
                    <GradientStop Color="#FFEEEEEE" Offset="0.712" />
                </LinearGradientBrush>
            </Border.Background>
        </Border>

        <Border CornerRadius="7,7,0,0" Width="{Binding ElementName=LayoutRoot, Path=ActualWidth}" Height="{Binding HeaderHeight, FallbackValue=50}" VerticalAlignment="Top" HorizontalAlignment="Stretch" BorderBrush="#FFB1B1B1" BorderThickness="1,1,1,1">
            <Border.Background>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFEDEDED" />
                    <GradientStop Color="#FFDEDEDE" Offset="0.3"/>
                    <GradientStop Color="#FFD5D5D5" Offset="0.6" />
                </LinearGradientBrush>
            </Border.Background>
            <Label Content="{Binding Header,FallbackValue=Test_Header}" Height="{Binding HeaderHeight, FallbackValue=50}" MaxHeight="{Binding HeaderHeight, FallbackValue=50}" Style="{StaticResource HeaderStyle}" HorizontalContentAlignment="{Binding HeaderPosition, Converter={StaticResource EnumToString}, FallbackValue=Left}"  VerticalAlignment="Top" HorizontalAlignment="Stretch" BorderBrush="Transparent" BorderThickness="0"/>
        </Border>


    </Grid>

</UserControl>
