<UserControl x:Class="MECF.Framework.Simulator.Core.LoadPorts.HPA48View"
             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:MECF.Framework.Simulator.Core.LoadPorts"
             xmlns:deviceControl="clr-namespace:MECF.Framework.UI.Core.DeviceControl;assembly=MECF.Framework.UI.Core"
             xmlns:commons="clr-namespace:MECF.Framework.Simulator.Core.Commons"
             Height="900"  Width="900">
    <UserControl.Resources>
        <DataTemplate x:Key="DataTemplate1">
            <StackPanel Orientation="Horizontal" Width="200" Height="15">
                <TextBox Text="{Binding Index}"></TextBox>
                <TextBox Text="{Binding State}"></TextBox>
                <Button Content="{Binding State}" Margin="0" Width="100" Height="15" Background="LightBlue" VerticalAlignment="Center"></Button>
                <TextBox Text="{Binding Index}"></TextBox>

            </StackPanel>
        </DataTemplate>
    </UserControl.Resources>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="100"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="50"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <commons:SerialPortTitleView Grid.Row="0"/>
        <StackPanel Grid.Row="2" Orientation="Horizontal" Width="900">
            <Button Content="Clear Log" Width="100" Height="35"   Command="{Binding ClearLogCommand}"></Button>

            <CheckBox 
                Content="Gen BAL Error" 
                VerticalAlignment="Center"
                Margin="10 0 0 0"
                IsChecked="{Binding IsGenBALError, Mode=OneWayToSource}"/>

        </StackPanel>


        <DataGrid Grid.Row="3" FontSize="16" AutoGenerateColumns="False" CanUserAddRows="False" CanUserResizeRows="False" CanUserSortColumns="False" ItemsSource="{Binding TransactionLogItems}" 
                      ScrollViewer.CanContentScroll="True" 
                      ScrollViewer.VerticalScrollBarVisibility="Auto"
                      ScrollViewer.HorizontalScrollBarVisibility="Auto"
                      Width="900" Height="380" VerticalAlignment="Top">
            <DataGrid.Columns>

                <DataGridTextColumn Header="Time" Width="160" IsReadOnly="True" Binding="{Binding OccurTime, UpdateSourceTrigger=PropertyChanged}"/>

                <DataGridTextColumn Header="Incoming" Width="350" IsReadOnly="True"  Binding="{Binding Incoming, UpdateSourceTrigger=PropertyChanged}">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="TextBlock">
                            <Setter Property="TextWrapping" Value="Wrap"/>
                            <Setter Property="Height" Value="auto"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>


                <DataGridTextColumn Header="Outgoing" Width="350" IsReadOnly="True"  Binding="{Binding Outgoing, UpdateSourceTrigger=PropertyChanged}">
                    <DataGridTextColumn.ElementStyle>
                        <Style TargetType="TextBlock">
                            <Setter Property="TextWrapping" Value="Wrap"/>
                            <Setter Property="Height" Value="auto"/>
                        </Style>
                    </DataGridTextColumn.ElementStyle>
                </DataGridTextColumn>

            </DataGrid.Columns>
        </DataGrid>
    </Grid>

</UserControl>