<UserControl
    x:Class="MECF.Framework.UI.Client.CenterViews.Editors.Sequence.SequenceView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="clr-namespace:OpenSEMI.Ctrlib.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:dgExtension="clr-namespace:MECF.Framework.UI.Client.RecipeEditorLib.DGExtension"
    xmlns:editors="clr-namespace:MECF.Framework.UI.Client.CenterViews.Editors"
    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
    xmlns:lex="http://wpflocalizeextension.codeplex.com"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:micro="clr-namespace:Caliburn.Micro"
    xmlns:sequence="clr-namespace:MECF.Framework.UI.Client.CenterViews.Editors.Sequence"
    d:Background="LightSteelBlue"
    d:DataContext="{d:DesignInstance Type=sequence:SequenceViewModel,
                                     IsDesignTimeCreatable=False}"
    d:DesignHeight="450"
    d:DesignWidth="1900"
    lex:LocalizeDictionary.DesignCulture="en"
    lex:ResxLocalizationProvider.DefaultAssembly="Sicentury.Localization"
    lex:ResxLocalizationProvider.DefaultDictionary="lang_common"
    mc:Ignorable="d">

    <UserControl.Resources>

        <DataTemplate x:Key="SequenceColumnHeaderTemplate">
            <Grid Width="250" Margin="0,5">
                <Grid.LayoutTransform>
                    <TransformGroup>
                        <RotateTransform Angle="-90" />
                        <ScaleTransform ScaleX="1" ScaleY="-1" />
                    </TransformGroup>
                </Grid.LayoutTransform>
                <TextBlock
                    Margin="5,0"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Center"
                    FontFamily="Arial"
                    FontSize="16"
                    Text="{Binding DisplayName}" />
            </Grid>
        </DataTemplate>

        <DataTemplate x:Key="TemplateTextBlock">
            <Grid>
                <Grid.LayoutTransform>
                    <TransformGroup>
                        <RotateTransform Angle="-90" />
                        <ScaleTransform ScaleX="1" ScaleY="-1" />
                    </TransformGroup>
                </Grid.LayoutTransform>
                <Border
                    Width="150"
                    Height="30"
                    Padding="5,1"
                    BorderBrush="{DynamicResource Table_BD}"
                    BorderThickness="0,0,1,1">
                    <TextBlock
                        Width="Auto"
                        FontSize="14"
                        Text="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                        Visibility="{Binding Visible}" />
                </Border>
            </Grid>
        </DataTemplate>

        <DataTemplate x:Key="TemplateStep">
            <Grid>
                <Grid.LayoutTransform>
                    <TransformGroup>
                        <RotateTransform Angle="-90" />
                        <ScaleTransform ScaleX="1" ScaleY="-1" />
                    </TransformGroup>
                </Grid.LayoutTransform>
                <Border
                    Width="150"
                    Height="30"
                    Padding="5,1"
                    BorderBrush="{DynamicResource Table_BD}"
                    BorderThickness="0,1,1,1">
                    <StackPanel
                        HorizontalAlignment="Center"
                        VerticalAlignment="Center"
                        Orientation="Horizontal">
                        <controls:CheckBoxExt
                            Margin="0,4"
                            CheckBoxSaved="{Binding IsSaved, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                            IsChecked="{Binding IsChecked}" />
                        <TextBlock
                            HorizontalAlignment="Center"
                            VerticalAlignment="Center"
                            FontSize="14"
                            Text="{Binding Value}"
                            Visibility="{Binding Visible}" />
                    </StackPanel>
                </Border>
            </Grid>
        </DataTemplate>

        <DataTemplate x:Key="TemplateText">
            <Grid>
                <Grid.LayoutTransform>
                    <TransformGroup>
                        <RotateTransform Angle="-90" />
                        <ScaleTransform ScaleX="1" ScaleY="-1" />
                    </TransformGroup>
                </Grid.LayoutTransform>
                <Border
                    Width="150"
                    Height="30"
                    Padding="5,1"
                    BorderBrush="{DynamicResource Table_BD}"
                    BorderThickness="0,0,1,1">
                    <controls:TextBoxEx
                        Width="Auto"
                        FontSize="14"
                        IsEnabled="{Binding IsEnabled}"
                        Text="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                        TextSaved="{Binding IsSaved, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                        Visibility="{Binding Visible}" />
                </Border>
            </Grid>
        </DataTemplate>

        <DataTemplate x:Key="TemplateSignInteger">
            <Grid>
                <Grid.LayoutTransform>
                    <TransformGroup>
                        <RotateTransform Angle="-90" />
                        <ScaleTransform ScaleX="1" ScaleY="-1" />
                    </TransformGroup>
                </Grid.LayoutTransform>
                <Border
                    Width="150"
                    Padding="5,1"
                    BorderBrush="{DynamicResource Table_BD}"
                    BorderThickness="0,0,1,1">
                    <controls:TextBoxEx
                        Width="Auto"
                        EditBoxMode="SignInteger"
                        FontSize="14"
                        IsEnabled="{Binding IsEnabled}"
                        Text="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                        TextSaved="{Binding IsSaved, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                        Visibility="{Binding Visible}" />
                </Border>
            </Grid>
        </DataTemplate>

        <DataTemplate x:Key="TemplateRecipeSelection">
            <Grid>
                <Grid.LayoutTransform>
                    <TransformGroup>
                        <RotateTransform Angle="-90" />
                        <ScaleTransform ScaleX="1" ScaleY="-1" />
                    </TransformGroup>
                </Grid.LayoutTransform>
                <Border
                    Width="150"
                    Height="30"
                    Padding="5,1"
                    BorderBrush="{DynamicResource Table_BD}"
                    BorderThickness="0,0,1,1">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <controls:TextBoxEx
                            Width="Auto"
                            IsReadOnly="True"
                            Text="{Binding FileName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                            TextSaved="True"
                            ToolTip="{Binding RelativeSource={RelativeSource Self}, Path=Text}"
                            Visibility="{Binding Visible}" />
                        <Button
                            Grid.Column="1"
                            Width="25"
                            Height="23"
                            Margin="3,0,0,0"
                            Content="..."
                            Focusable="False"
                            FontSize="10"
                            Visibility="{Binding Visible}">
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="Click">
                                    <micro:ActionMessage MethodName="SelectRecipe">
                                        <micro:Parameter Value="{Binding}" />
                                    </micro:ActionMessage>
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </Button>
                    </Grid>
                </Border>
            </Grid>
        </DataTemplate>

        <DataTemplate x:Key="TemplateCombox">
            <Grid>
                <Grid.LayoutTransform>
                    <TransformGroup>
                        <RotateTransform Angle="-90" />
                        <ScaleTransform ScaleX="1" ScaleY="-1" />
                    </TransformGroup>
                </Grid.LayoutTransform>
                <Border
                    Width="150"
                    Padding="5,1"
                    BorderBrush="{DynamicResource Table_BD}"
                    BorderThickness="0,0,1,1">
                    <controls:ComboBoxExt
                        ComboBoxSaved="{Binding IsSaved, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                        DisplayMemberPath="DisplayName"
                        IsEnabled="{Binding IsEnabled}"
                        ItemsSource="{Binding Options}"
                        SelectedValue="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                        SelectedValuePath="ControlName"
                        Style="{StaticResource ResourceKey={x:Type ComboBox}}"
                        Visibility="{Binding Visible}" />
                </Border>
            </Grid>
        </DataTemplate>

        <DataTemplate x:Key="TemplateMultiSelection">
            <Grid>
                <Grid.LayoutTransform>
                    <TransformGroup>
                        <RotateTransform Angle="-90" />
                        <ScaleTransform ScaleX="1" ScaleY="-1" />
                    </TransformGroup>
                </Grid.LayoutTransform>
                <Border
                    MinHeight="30"
                    Padding="5,1"
                    BorderBrush="{DynamicResource Table_BD}"
                    BorderThickness="0,0,1,1">
                    <ListBox ItemsSource="{Binding Options}" Visibility="{Binding Visible}">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Margin="5,5" Orientation="Horizontal">
                                    <CheckBox IsChecked="{Binding IsChecked, UpdateSourceTrigger=PropertyChanged}" />
                                    <TextBlock Text="{Binding DisplayName}" />
                                </StackPanel>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                        <ListBox.ItemsPanel>
                            <ItemsPanelTemplate>
                                <WrapPanel
                                    Width="139"
                                    HorizontalAlignment="Center"
                                    VerticalAlignment="Center" />
                            </ItemsPanelTemplate>
                        </ListBox.ItemsPanel>
                    </ListBox>
                </Border>
            </Grid>
        </DataTemplate>

        <DataTemplate x:Key="ParamExpander">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <TextBlock Text="{Binding DisplayName}" />
                <Expander
                    Grid.Column="1"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Stretch"
                    HorizontalContentAlignment="Left"
                    VerticalContentAlignment="Stretch"
                    IsExpanded="{Binding IsExpanded}">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Expanded">
                            <micro:ActionMessage MethodName="ParamsExpanded">
                                <micro:Parameter Value="{Binding}" />
                            </micro:ActionMessage>
                        </i:EventTrigger>
                        <i:EventTrigger EventName="Collapsed">
                            <micro:ActionMessage MethodName="ParamsCollapsed">
                                <micro:Parameter Value="{Binding}" />
                            </micro:ActionMessage>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Expander>
                <Grid.LayoutTransform>
                    <TransformGroup>
                        <RotateTransform Angle="-90" />
                        <ScaleTransform ScaleX="1" ScaleY="-1" />
                    </TransformGroup>
                </Grid.LayoutTransform>
            </Grid>
        </DataTemplate>
        <DataTemplate x:Key="TemplateExpander">
            <TextBlock
                HorizontalAlignment="Left"
                VerticalAlignment="Center"
                FontFamily="Arial"
                FontSize="14">
                <TextBlock.LayoutTransform>
                    <TransformGroup>
                        <RotateTransform Angle="-90" />
                        <ScaleTransform ScaleX="1" ScaleY="-1" />
                    </TransformGroup>
                </TextBlock.LayoutTransform>
            </TextBlock>
        </DataTemplate>
        <HierarchicalDataTemplate x:Key="FolderTemplate" ItemsSource="{Binding Files}">
            <StackPanel Orientation="Horizontal" Tag="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Path=DataContext}">
                <Image
                    x:Name="ExpandImage"
                    Width="14"
                    Height="12"
                    Margin="2,0,0,0"
                    VerticalAlignment="Center"
                    Source="/MECF.Framework.UI.Client;component/Resources/Images/Folder_Close.png" />
                <TextBlock
                    Margin="5,0,0,0"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Center"
                    Text="{Binding Name}" />
                <StackPanel.ContextMenu>
                    <ContextMenu DataContext="{Binding Path=PlacementTarget.Tag, RelativeSource={RelativeSource Self}}">
                        <MenuItem Command="{Binding NewSequenceCommand}" Header="Create Sequence" />
                        <Separator />
                        <MenuItem Command="{Binding NewFolderCommand}" Header="Create Folder" />
                        <MenuItem Command="{Binding DeleteFolderCommand}" Header="Delete Folder" />
                    </ContextMenu>
                </StackPanel.ContextMenu>
            </StackPanel>
            <HierarchicalDataTemplate.Triggers>
                <Trigger Property="IsEnabled" Value="false">
                    <Setter TargetName="ExpandImage" Property="Image.Source" Value="/MECF.Framework.UI.Client;component/Resources/Images/Folder_Unable.png" />
                </Trigger>
                <!--<DataTrigger Binding="{Binding HasItems}" Value="True">
                <Setter Property="Image.Source" TargetName="ExpandImage" Value="Folder_Open.png"/>
            </DataTrigger>-->
            </HierarchicalDataTemplate.Triggers>
        </HierarchicalDataTemplate>

        <HierarchicalDataTemplate x:Key="FileTemplate" ItemsSource="{Binding Files}">
            <StackPanel Orientation="Horizontal" Tag="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Path=DataContext}">
                <Path
                    Width="13"
                    Height="16"
                    HorizontalAlignment="Left"
                    Data="M0.5,5.125 L5.125,5.125 5.125,0.5 M5.1,0.5 L15.5,0.5 15.5,19.5 0.5,19.5 C0.5,14.7 0.5,10 0.5,5.1 2,3.6 3.6,2 5.1,0.5 z M8.1,8.5 L8.2,8.5 z M8.1,11.5 L8.2,11.5 z M8.1,14.5 L8.2,14.5 z"
                    Fill="#FFF3F3F3"
                    Stretch="Fill"
                    Stroke="#FF454545" />
                <TextBlock
                    Margin="5,0,0,0"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Center"
                    Text="{Binding Name}" />
                <StackPanel.ContextMenu>
                    <ContextMenu DataContext="{Binding Path=PlacementTarget.Tag, RelativeSource={RelativeSource Self}}">
                        <MenuItem Command="{Binding SaveAsCommand}" Header="Save As..." />
                        <MenuItem Command="{Binding RenameCommand}" Header="Rename Sequence" />
                        <MenuItem Command="{Binding DeleteSequenceCommand}" Header="Delete Sequence" />
                    </ContextMenu>
                </StackPanel.ContextMenu>
            </StackPanel>
        </HierarchicalDataTemplate>
        <editors:FolderOrFileTemplateSelector
            x:Key="FolderFileTemplateSelector"
            FileTemplate="{StaticResource FileTemplate}"
            FolderTemplate="{StaticResource FolderTemplate}" />

    </UserControl.Resources>


    <Grid HorizontalAlignment="Left">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" MinWidth="275" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <GridSplitter
            Width="5"
            Margin="0,0,-5,0"
            HorizontalAlignment="Right"
            BorderThickness="0,8">
            <GridSplitter.Background>
                <SolidColorBrush />
            </GridSplitter.Background>
        </GridSplitter>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="740" />
            </Grid.RowDefinitions>

            <StackPanel IsEnabled="{Binding IsPermission}" Orientation="Horizontal">
                <Button
                    Width="76"
                    Height="30"
                    Content="{lex:Loc ID_BTN_New_Content}"
                    IsEnabled="{Binding EnableNew}">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <micro:ActionMessage MethodName="NewSequence" />
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Button>
                <Button
                    Width="76"
                    Height="30"
                    Margin="2,0,0,0"
                    Content="{lex:Loc ID_BTN_Rename_Content}"
                    IsEnabled="{Binding EnableReName}">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <micro:ActionMessage MethodName="RenameSequence" />
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Button>
                <Button
                    Width="76"
                    Height="30"
                    Margin="2,0,0,0"
                    Content="{lex:Loc ID_BTN_Delete_Content}"
                    IsEnabled="{Binding EnableDelete}">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <micro:ActionMessage MethodName="DeleteSequence" />
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Button>

                <Button
                    Width="76"
                    Height="30"
                    Margin="2,0,0,0"
                    Content="{lex:Loc ID_BTN_Refresh_Content}">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <micro:ActionMessage MethodName="RefreshSequence" />
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Button>
            </StackPanel>

            <Border
                Grid.Row="1"
                Margin="0,5,0,0"
                Background="{DynamicResource Tab_BG}"
                BorderBrush="{DynamicResource Tab_BD}"
                BorderThickness="1">
                <TreeView
                    x:Name="PART_TREE"
                    Grid.Row="1"
                    Height="{Binding Path=ActualHeight, ElementName=PART_BORDER, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
                    Margin="5"
                    ItemTemplateSelector="{StaticResource FolderFileTemplateSelector}"
                    ItemsSource="{Binding Files[0].Files}"
                    VirtualizingPanel.IsVirtualizing="True"
                    VirtualizingPanel.VirtualizationMode="Recycling">
                    <!--  Height should add for VirtualizingPanel, otherwise the App will be slow  -->
                    <TreeView.ItemContainerStyle>
                        <Style BasedOn="{StaticResource ResourceKey={x:Type TreeViewItem}}" TargetType="{x:Type TreeViewItem}">
                            <Setter Property="IsExpanded" Value="True" />
                        </Style>
                    </TreeView.ItemContainerStyle>
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="SelectedItemChanged">
                            <micro:ActionMessage MethodName="TreeSelectChanged">
                                <micro:Parameter Value="{Binding SelectedItem, ElementName=PART_TREE}" />
                            </micro:ActionMessage>
                        </i:EventTrigger>
                        <i:EventTrigger EventName="MouseRightButtonDown">
                            <micro:ActionMessage MethodName="TreeRightMouseDown">
                                <micro:Parameter Value="$eventargs" />
                            </micro:ActionMessage>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>

                    <TreeView.ContextMenu>
                        <ContextMenu>
                            <MenuItem Command="{Binding NewSequenceInParentCommand}" Header="New Sequence" />
                            <Separator />
                            <!--<MenuItem Header="New Folder" Command="{Binding NewFolderInParentCommand}">
                            </MenuItem>-->
                        </ContextMenu>
                    </TreeView.ContextMenu>
                </TreeView>
            </Border>
        </Grid>
        <Grid Grid.Column="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition />
            </Grid.RowDefinitions>
            <Grid
                Width="1600"
                Margin="10,0,0,0"
                HorizontalAlignment="Left"
                IsEnabled="{Binding IsPermission}">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="150" />
                    <ColumnDefinition Width="10*" />
                    <ColumnDefinition Width="150" />
                    <ColumnDefinition Width="8*" />
                    <ColumnDefinition Width="8*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="30" />
                    <RowDefinition Height="30" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Border
                    Padding="5,1"
                    Background="{DynamicResource Table_BG_Title}"
                    BorderBrush="{DynamicResource Table_BD}"
                    BorderThickness="1">
                    <TextBlock
                        VerticalAlignment="Center"
                        FontFamily="Arial"
                        FontSize="16"
                        Foreground="{DynamicResource FG_Black}"
                        Text="{lex:Loc ID_TXT_Name}"
                        TextWrapping="Wrap" />
                </Border>
                <Border
                    Grid.Column="1"
                    Padding="5,1"
                    Background="{DynamicResource Table_BG_Content}"
                    BorderBrush="{DynamicResource Table_BD}"
                    BorderThickness="0,1,1,1">
                    <controls:TextBoxEx
                        Width="Auto"
                        MinWidth="100"
                        VerticalAlignment="Center"
                        AllowBackgroundChange="False"
                        IsEnabled="false"
                        Text="{Binding CurrentSequence.Name}"
                        TextWrapping="Wrap" />
                </Border>
                <Border
                    Grid.Column="2"
                    Padding="5,1"
                    Background="{DynamicResource Table_BG_Title}"
                    BorderBrush="{DynamicResource Table_BD}"
                    BorderThickness="0,1,1,1">
                    <TextBlock
                        VerticalAlignment="Center"
                        FontFamily="Arial"
                        FontSize="16"
                        Foreground="{DynamicResource FG_Black}"
                        Text="{lex:Loc ID_TXT_Create}"
                        TextWrapping="Wrap" />
                </Border>
                <Border
                    Grid.Column="3"
                    Padding="5,1"
                    Background="{DynamicResource Table_BG_Content}"
                    BorderBrush="{DynamicResource Table_BD}"
                    BorderThickness="0,1,1,1">
                    <TextBlock
                        Width="Auto"
                        MinWidth="100"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Center"
                        FontFamily="Arial"
                        FontSize="14"
                        Foreground="{DynamicResource FG_Black}"
                        Text="{Binding CurrentSequence.Creator}"
                        TextWrapping="Wrap" />
                </Border>
                <Border
                    Grid.Column="4"
                    Padding="5,1"
                    Background="{DynamicResource Table_BG_Content}"
                    BorderBrush="{DynamicResource Table_BD}"
                    BorderThickness="0,1,1,1">
                    <TextBlock
                        Width="Auto"
                        MinWidth="100"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Center"
                        FontFamily="Arial"
                        FontSize="14"
                        Foreground="{DynamicResource FG_Black}"
                        Text="{Binding CurrentSequence.CreateTime}"
                        TextWrapping="Wrap" />
                </Border>
                <Border
                    Grid.Row="1"
                    Padding="5,1"
                    Background="{DynamicResource Table_BG_Title}"
                    BorderBrush="{DynamicResource Table_BD}"
                    BorderThickness="1,0,1,1">
                    <TextBlock
                        VerticalAlignment="Center"
                        FontFamily="Arial"
                        FontSize="16"
                        Foreground="{DynamicResource FG_Black}"
                        Text="{lex:Loc ID_TXT_Description}"
                        TextWrapping="Wrap" />
                </Border>
                <Border
                    Grid.Row="1"
                    Grid.Column="1"
                    Padding="5,1"
                    Background="{DynamicResource Table_BG_Content}"
                    BorderBrush="{DynamicResource Table_BD}"
                    BorderThickness="0,0,1,1">
                    <controls:TextBoxEx
                        Width="Auto"
                        MinWidth="100"
                        VerticalAlignment="Center"
                        Text="{Binding CurrentSequence.Description}"
                        TextSaved="{Binding IsSavedDesc, Mode=TwoWay}"
                        TextWrapping="Wrap" />
                </Border>
                <Border
                    Grid.Row="1"
                    Grid.Column="2"
                    Padding="5,1"
                    Background="{DynamicResource Table_BG_Title}"
                    BorderBrush="{DynamicResource Table_BD}"
                    BorderThickness="0,0,1,1">
                    <TextBlock
                        VerticalAlignment="Center"
                        FontFamily="Arial"
                        FontSize="16"
                        Foreground="{DynamicResource FG_Black}"
                        Text="{lex:Loc ID_TXT_Revise}"
                        TextWrapping="Wrap" />
                </Border>
                <Border
                    Grid.Row="1"
                    Grid.Column="3"
                    Padding="5,1"
                    Background="{DynamicResource Table_BG_Content}"
                    BorderBrush="{DynamicResource Table_BD}"
                    BorderThickness="0,0,1,1">
                    <TextBlock
                        Width="120"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Center"
                        FontFamily="Arial"
                        FontSize="14"
                        Foreground="{DynamicResource FG_Black}"
                        Text="{Binding CurrentSequence.Revisor}"
                        TextWrapping="Wrap" />
                </Border>
                <Border
                    Grid.Row="1"
                    Grid.Column="4"
                    Padding="5,1"
                    Background="{DynamicResource Table_BG_Content}"
                    BorderBrush="{DynamicResource Table_BD}"
                    BorderThickness="0,0,1,1">
                    <TextBlock
                        MinWidth="140"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Center"
                        FontFamily="Arial"
                        FontSize="14"
                        Foreground="{DynamicResource FG_Black}"
                        Text="{Binding CurrentSequence.ReviseTime}"
                        TextWrapping="Wrap" />
                </Border>

            </Grid>
            <Grid Grid.Row="1" Margin="10,10,0,0">
                <Grid.RowDefinitions>
                    <RowDefinition Height="50" />
                    <RowDefinition />
                </Grid.RowDefinitions>
                <Grid>
                    <StackPanel IsEnabled="{Binding IsPermission}" Orientation="Horizontal">
                        <Button
                            Width="90"
                            Height="30"
                            Content="{lex:Loc ID_BTN_Append_Content}"
                            IsEnabled="{Binding EnableStep}">
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="Click">
                                    <micro:ActionMessage MethodName="AddStep" />
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </Button>
                        <Button
                            Width="90"
                            Height="30"
                            Margin="10,0,0,0"
                            Content="{lex:Loc ID_BTN_Insert_Content}"
                            IsEnabled="{Binding EnableStep}">
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="Click">
                                    <micro:ActionMessage MethodName="AppendStep" />
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </Button>
                        <Button
                            Width="90"
                            Height="30"
                            Margin="10,0,0,0"
                            Content="{lex:Loc ID_BTN_Copy_Content}"
                            IsEnabled="{Binding EnableStep}">
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="Click">
                                    <micro:ActionMessage MethodName="CopyStep" />
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </Button>
                        <Button
                            Width="90"
                            Height="30"
                            Margin="10,0,0,0"
                            Content="{lex:Loc ID_BTN_Paste_Content}"
                            IsEnabled="{Binding EnableStep}">
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="Click">
                                    <micro:ActionMessage MethodName="PasteStep" />
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </Button>
                        <Button
                            Width="90"
                            Height="30"
                            Margin="10,0,0,0"
                            Content="{lex:Loc ID_BTN_Delete_Content}"
                            IsEnabled="{Binding EnableStep}">
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="Click">
                                    <micro:ActionMessage MethodName="DeleteStep" />
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </Button>
                        <Button
                            Width="90"
                            Height="30"
                            Margin="200,0,0,0"
                            Content="{lex:Loc ID_BTN_Reload_Content}">
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="Click">
                                    <micro:ActionMessage MethodName="ReloadSequence" />
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </Button>
                        <Button
                            Width="90"
                            Height="30"
                            Margin="10,0,0,0"
                            Content="{lex:Loc ID_BTN_Save_Content}"
                            IsEnabled="{Binding EnableSave}">
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="Click">
                                    <micro:ActionMessage MethodName="SaveSequence" />
                                </i:EventTrigger>
                            </i:Interaction.Triggers>
                        </Button>
                    </StackPanel>
                </Grid>
                <Grid
                    Grid.Row="1"
                    HorizontalAlignment="Left"
                    VerticalAlignment="Top">
                    <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
                        <dgExtension:XDataGrid
                            x:Name="dgCustom"
                            AlternationCount="2"
                            AutoGenerateColumns="False"
                            Background="#00FFFFFF"
                            CanUserAddRows="False"
                            CanUserDeleteRows="False"
                            CanUserResizeColumns="False"
                            CanUserResizeRows="False"
                            GridLinesVisibility="None"
                            HeadersVisibility="Column"
                            IsEnabled="{Binding IsPermission}"
                            UseHorizontalScrolling="True"
                            VirtualizingPanel.IsVirtualizing="True"
                            VirtualizingPanel.VirtualizationMode="Recycling">
                            <dgExtension:XDataGrid.LayoutTransform>
                                <TransformGroup>
                                    <RotateTransform Angle="-90" />
                                    <ScaleTransform ScaleX="1" ScaleY="-1" />
                                </TransformGroup>
                            </dgExtension:XDataGrid.LayoutTransform>
                        </dgExtension:XDataGrid>
                    </ScrollViewer>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition MaxWidth="263" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Rectangle
                            Height="1"
                            VerticalAlignment="Top"
                            Fill="{DynamicResource Table_BD}" />
                    </Grid>
                </Grid>
            </Grid>
        </Grid>
    </Grid>
</UserControl>

