<UserControl x:Class="FasdDesktopUi.Pages.DetailsPage.UserControls.DetailsPageDataHistoryCollection"
             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.Pages.DetailsPage.UserControls"
             xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
             xmlns:config="clr-namespace:C4IT.FASD.Base;assembly=F4SD-Cockpit-Client-Base"
             xmlns:vc="clr-namespace:FasdDesktopUi.Basics.Converter"
             mc:Ignorable="d"
             d:DesignHeight="450"
             d:DesignWidth="800"
             Name="_thisCollection"
             Initialized="UserControl_Initialized">

    <UserControl.Resources>
        <vc:LanguageDefinitionsConverter x:Key="LanguageConverter" />
        <BooleanToVisibilityConverter x:Key="BoolToVisibility" />
    </UserControl.Resources>

    <DockPanel x:Name="DataHistoryDock"
               HorizontalAlignment="Left">

        <Grid DockPanel.Dock="Top"
              HorizontalAlignment="Left"
              Margin="0, 10, 0, 0"
              Width="{Binding ElementName=DetailsCollectionScrollViewer, Path=ActualWidth}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <TextBlock x:Name="ToggleCollapseButton"
                       Grid.Column="3"
                       Style="{DynamicResource DetailsPage.DataHistory.ControlBar.Text}"
                       Margin="0,0,16,0">
                
                <Run Text="{Binding Mode=OneWay, Converter={StaticResource LanguageConverter}, ConverterParameter=DetailsPage.History.UnCollapseAll}"
                     Style="{DynamicResource DetailsPage.DataHistory.ControlBar.Action}"
                     MouseUp="UnCollapseButton_MouseUp"
                     TouchDown="UnCollapseButton_TouchDown" />
                |
                <Run Text="{Binding Mode=OneWay, Converter={StaticResource LanguageConverter}, ConverterParameter=DetailsPage.History.CollapseAll}"
                     Style="{DynamicResource DetailsPage.DataHistory.ControlBar.Action}"
                     MouseUp="CollapseButton_MouseUp"
                     TouchDown="CollapseButton_TouchDown" />
            </TextBlock>
        </Grid>

        <ScrollViewer x:Name="DetailsCollectionScrollViewer"
                      DockPanel.Dock="Top"
                      HorizontalScrollBarVisibility="Disabled"
                      VerticalScrollBarVisibility="Auto"
                      HorizontalAlignment="Left"
                      Padding="0, 0, 8, 8"
                      Margin="0,5,0,0"
                      FocusVisualStyle="{x:Null}"
                      PreviewKeyDown="DetailsCollectionScrollViewer_PreviewKeyDown">

            <StackPanel x:Name="DataHistoryCollectionStackPanel"
                        HorizontalAlignment="Left">
                <StackPanel.Resources>
                    <Style TargetType="Border">
                        <Setter Property="Padding"
                                Value="0, 2.5" />
                    </Style>
                </StackPanel.Resources>
            </StackPanel>

        </ScrollViewer>
    </DockPanel>

</UserControl>
