<UserControl x:Class="FasdDesktopUi.Basics.UserControls.QuickTip.QuickTipStep"
             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:local="clr-namespace:FasdDesktopUi.Basics.UserControls.QuickTip"
             xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
             xmlns:gif="http://wpfanimatedgif.codeplex.com"
             xmlns:converter="clr-namespace:FasdDesktopUi.Basics.Converter"
             mc:Ignorable="d" 
             d:DesignHeight="150" d:DesignWidth="380"
             Cursor="Hand"
             x:Name="StepUc">

    <UserControl.Resources>
        <converter:LanguageDefinitionsConverter x:Key="LanguageConverter" />
        <Style x:Key="StatusIcon" TargetType="ico:AdaptableIcon">
            <Setter Property="BorderPadding" Value="0"/>
            <Setter Property="Margin" Value="0,-2"/>
            <Setter Property="IconWidth" Value="20"/>
            <Setter Property="IconHeight" Value="20"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="PrimaryIconColor" Value="{DynamicResource Color.Menu.Icon}"/>
            <Setter Property="Opacity" Value="0.35"/>
            <EventSetter Event="MouseLeftButtonUp" Handler="SelectStatus_MouseLeftButtonUp"/>
            <EventSetter Event="TouchDown" Handler="SelectStatus_TouchDown"/>
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Cursor" Value="Hand"/>
                </Trigger>
            </Style.Triggers>
        </Style>
        <Style x:Key="StepBorder" TargetType="Border">
            <Setter Property="Background" Value="{DynamicResource BackgroundColor.Menu.MainCategory}"/>
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="Background" Value="{DynamicResource BackgroundColor.Menu.MainCategory.Hover}"/>
                </Trigger>
            </Style.Triggers>
        </Style>
    </UserControl.Resources>
    
    <Border
        x:Name="MainBorder"
        x:FieldModifier="private"
        Style="{DynamicResource StepBorder}"
        BorderThickness="2"
        CornerRadius="10"
        Padding="8"
        Margin="0 0 0 2.5"
        MouseLeftButtonUp="MainBorder_MouseLeftButtonUp"
        TouchDown="MainBorder_TouchDown"
        MouseEnter="MainBorder_MouseEnter"
        MouseLeave="MainBorder_MouseLeave">

        <StackPanel>

            <ico:AdaptableIcon
                x:Name="RequiredIcon"
                Margin=" 0 -10 -10 -5 "
                BorderPadding="5"
                IconHeight="15"
                IconWidth="15"
                HorizontalAlignment="Right"
                SelectedInternIcon="misc_dot"
                PrimaryIconColor="{DynamicResource HighlightColor.Red}"
                Visibility="Hidden"
                IsHitTestVisible="False"
                ToolTip="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=QuickTips.Steps.Required}"/>


            <DockPanel LastChildFill="False">

                <ico:AdaptableIcon 
                    x:Name="StepTypeIcon"
                    DockPanel.Dock="Right"
                    Style="{DynamicResource Menu.MenuBar.PinnedIcon.Base}"
                    VerticalAlignment="Center"
                    Margin=" 0 0 7.5 0 "
                    BorderPadding="0"
                    IconHeight="15"
                    IconWidth="15"
                    SelectedInternIcon="{Binding StepTypeIconData.Intern, ElementName=StepUc}"/>

                <ico:AdaptableIcon 
                    x:Name="HeadingIcon"
                    DockPanel.Dock="Left"
                    PrimaryIconColor="{DynamicResource Color.Menu.Icon}"
                    VerticalAlignment="Center"
                    Margin="7.5 0 0 0"
                    BorderPadding="0"
                    IconHeight="15"
                    IconWidth="15"
                    SelectedInternIcon="{Binding StepIcon.Intern, ElementName=StepUc}"
                    SelectedMaterialIcon="{Binding StepIcon.Material, ElementName=StepUc}"/>

                <TextBlock 
                    x:Name="HeadingText"
                    Text="{Binding StepData.ElementName, ElementName=StepUc}"
                    DockPanel.Dock="Left"
                    Style="{DynamicResource DetailsPage.DataHistory.TitleColumn.OverviewTitle}"
                    VerticalAlignment="Center"
                    HorizontalAlignment="Left"
                    Margin="5" />

            </DockPanel>

            <TextBlock
                x:Name="DescriptionTextBlock"
                Text="{Binding StepData.TextBlock, ElementName=StepUc}"
                Foreground="{DynamicResource FontColor.DetailsPage.DataHistory.Value}"
                FontFamily="Calibri"
                FontSize="14"
                FontWeight="Regular"
                TextWrapping="Wrap"
                VerticalAlignment="Top"
                HorizontalAlignment="Left"/>

            <Border
                x:Name="StatusControl"
                HorizontalAlignment="Right"
                Width="70"
                Height="20"
                BorderBrush="{DynamicResource FontColor.Menu.Categories}"
                BorderThickness="1"
                CornerRadius="10"
                IsHitTestVisible="False"
                Margin="0,5,0,0">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="*"/>
                        <ColumnDefinition Width="*"/>
                    </Grid.ColumnDefinitions>

                    <ico:AdaptableIcon x:Name="ErrorIcon"
                                       Tag="Error"
                                       Grid.Column="0"
                                       SelectedMaterialIcon="ic_cancel"
                                       HorizontalAlignment="Left"
                                       Style="{DynamicResource StatusIcon}"
                                       ToolTip="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=QuickTips.Steps.Failed}"/>
                    <ico:AdaptableIcon
                        x:Name="UnknownIcon"
                        Tag="Unknown"
                        Grid.Column="1"
                        SelectedMaterialIcon="ic_do_not_disturb_on"
                        HorizontalAlignment="Center"
                        Style="{DynamicResource StatusIcon}"
                        Opacity="1"
                                       ToolTip="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=QuickTips.Steps.Unknown}" />
                    <ico:AdaptableIcon
                        x:Name="FinishedIcon"
                        Tag="Finished"
                        Grid.Column="2"
                        SelectedMaterialIcon="ic_check_circle"
                        HorizontalAlignment="Right"
                        Style="{DynamicResource StatusIcon}"
                                       ToolTip="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=QuickTips.Steps.Succeeded}" />

                </Grid>
            </Border>

        </StackPanel>

    </Border>
</UserControl>
