<UserControl
    x:Class="MECF.Framework.UI.Client.CenterViews.Editors.Recipe.RecipeHistoryView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:local="clr-namespace:MECF.Framework.UI.Client.CenterViews.Editors.Recipe"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:micro="clr-namespace:Caliburn.Micro"
    d:DesignHeight="450"
    d:DesignWidth="800"
    mc:Ignorable="d">
    <UserControl.Resources>
        <ResourceDictionary>
            <local:RowToIndexConverter x:Key="rowToIndexConverter" />
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid Margin="5">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="40" />
        </Grid.RowDefinitions>
        <DataGrid
            Grid.Column="3"
            AlternationCount="2"
            AutoGenerateColumns="False"
            CanUserAddRows="False"
            FontSize="13"
            IsReadOnly="True"
            ItemsSource="{Binding RecipeMemorieList}"
            ScrollViewer.VerticalScrollBarVisibility="Visible"
            SelectedItem="{Binding SelectRecipeHistory}">
            <DataGrid.Columns>
                <DataGridTemplateColumn Width="20">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <CheckBox>
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <micro:ActionMessage MethodName="SelChanged">
                                            <micro:Parameter Value="{Binding Path=IsChecked, RelativeSource={RelativeSource AncestorType={x:Type CheckBox}}}" />
                                        </micro:ActionMessage>
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </CheckBox>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTextColumn
                    Width="30"
                    Binding="{Binding RelativeSource={RelativeSource AncestorType=DataGridRow}, Converter={StaticResource rowToIndexConverter}}"
                    Header="ID" />
                <DataGridTextColumn
                    Width="100"
                    Binding="{Binding RoleName}"
                    Header="RoleName" />
                <DataGridTextColumn
                    Width="Auto"
                    Binding="{Binding RecipeName}"
                    Header="RecipeName" />
                <DataGridTextColumn
                    Width="100"
                    Binding="{Binding ProcessType}"
                    Header="ProcessType" />
                <DataGridTextColumn
                    Width="200"
                    Binding="{Binding CreateTime}"
                    Header="Time" />
                <!--<DataGridTemplateColumn Width="100" Header="Compare">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Button Margin="10,0" Content="Statr">
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="Click">
                                        <micro:ActionMessage MethodName="StatrCompare" />
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Button>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>-->

            </DataGrid.Columns>

        </DataGrid>
        <StackPanel
            Grid.Row="1"
            Margin="0,10,0,0"
            HorizontalAlignment="Center"
            Orientation="Horizontal">
            <Button
                Width="90"
                Height="30"
                Content="OK">
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="Click">
                        <micro:ActionMessage MethodName="OK" />
                    </i:EventTrigger>
                </i:Interaction.Triggers>
            </Button>
            <Button
                Width="90"
                Height="30"
                Margin="10,0,0,0"
                Content="Cancel">
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="Click">
                        <micro:ActionMessage MethodName="Cancel" />
                    </i:EventTrigger>
                </i:Interaction.Triggers>
            </Button>
        </StackPanel>
    </Grid>
</UserControl>
