<UserControl x:Class="MECF.Framework.UI.Core.Control.SimulatorDiItemEditor"
             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.UI.Core.Control"
             xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid"
             mc:Ignorable="d" 
             d:DesignHeight="900"  d:DesignWidth="1000">
 
    <Grid>
        <DataGrid AutoGenerateColumns="False" Margin="0,0,0,0" Padding="0" 
                  Background="White" ItemsSource="{Binding DiItemList, Mode=OneWay}" 
                   SelectionMode="Single" SelectionUnit="CellOrRowHeader"
                  FontFamily="Arial,SimSun" FontSize="17"                     
                  BorderThickness="0.1" RowHeight="35"
                  CanUserDeleteRows="False" CanUserAddRows="False" IsReadOnly="True" >
 
            <DataGrid.Columns>
                <DataGridTextColumn Header="Index" Width="50" CanUserSort="True" IsReadOnly="True" Binding="{Binding Index,Mode=OneWay}">

                </DataGridTextColumn>

                <DataGridTextColumn Header="Address" Width="80" CanUserSort="True" IsReadOnly="True" Binding="{Binding Address,Mode=OneWay}">

                </DataGridTextColumn>
 

                <DataGridTemplateColumn Header="Item" Width="300" >
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <ToggleButton VerticalAlignment="Stretch"  HorizontalAlignment="Stretch" SnapsToDevicePixels="True" Padding="0" Margin="0" Content="{Binding Name, Mode=OneWay }" Height="20" IsChecked="{Binding BoolValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="12"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>

 

                <DataGridTemplateColumn Header="Value" Width="50"  >
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <CheckBox IsChecked="{Binding HoldValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="12"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>

                <DataGridTemplateColumn Header="Description" Width="300"  >
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBox Text="{Binding Description, Mode=OneWay }"  VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Padding="0" Margin="0" IsReadOnly="True" IsEnabled="False" TextWrapping="Wrap"  FontSize="12"/>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>


            </DataGrid.Columns>
        </DataGrid>

    </Grid>
</UserControl>
