<UserControl x:Class="FasdDesktopUi.Basics.UserControls.Badge"
             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"
             mc:Ignorable="d"
             d:DesignHeight="20"
             d:DesignWidth="40"
             x:Name="BadgeControl"
             Loaded="BadgeControl_Loaded"
             Unloaded="BadgeControl_Unloaded">

    <Grid ClipToBounds="False">
        <Border Background="{DynamicResource Color.SoftContrast}"
                CornerRadius="5">
            <StackPanel HorizontalAlignment="Center"
                        VerticalAlignment="Center"
                        Orientation="Horizontal"
                        Margin="7.5 2.5">
                <TextBlock FontSize="12"
                           FontWeight="Bold"
                           Foreground="{DynamicResource FontColor.DetailsPage.DataHistory.Value}"
                           Text="{Binding ElementName=BadgeControl, Path=Text}" />
            </StackPanel>
        </Border>

        <Canvas x:Name="SparkleCanvas"
                IsHitTestVisible="False"
                ClipToBounds="False"
                Visibility="Collapsed">
            <Grid x:Name="SparkleTopRight"
                  Canvas.Right="-3"
                  Canvas.Top="-4"
                  Opacity="0"
                  RenderTransformOrigin="0.5,0.5">
                <Grid.RenderTransform>
                    <ScaleTransform ScaleX="0.6" ScaleY="0.6" />
                </Grid.RenderTransform>
                <Rectangle Width="2"
                           Height="8"
                           RadiusX="1"
                           RadiusY="1"
                           Fill="{DynamicResource FontColor.DetailsPage.DataHistory.Value}" />
                <Rectangle Width="8"
                           Height="2"
                           RadiusX="1"
                           RadiusY="1"
                           Fill="{DynamicResource FontColor.DetailsPage.DataHistory.Value}" />
            </Grid>

            <Grid x:Name="SparkleBottomLeft"
                  Canvas.Left="-3"
                  Canvas.Bottom="-4"
                  Opacity="0"
                  RenderTransformOrigin="0.5,0.5">
                <Grid.RenderTransform>
                    <ScaleTransform ScaleX="0.6" ScaleY="0.6" />
                </Grid.RenderTransform>
                <Rectangle Width="2"
                           Height="8"
                           RadiusX="1"
                           RadiusY="1"
                           Fill="{DynamicResource FontColor.DetailsPage.DataHistory.Value}" />
                <Rectangle Width="8"
                           Height="2"
                           RadiusX="1"
                           RadiusY="1"
                           Fill="{DynamicResource FontColor.DetailsPage.DataHistory.Value}" />
            </Grid>
        </Canvas>
    </Grid>
</UserControl>
