<UserControl x:Class="MECF.Framework.UI.Client.CenterViews.Maintain.ViewModels.MaintainConfigView"
             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.Client.CenterViews.Maintain"
             xmlns:behavior="clr-namespace:MECF.Framework.UI.Client.CenterViews.Maintain.Behavior"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:extendedControls="clr-namespace:MECF.Framework.UI.Core.ExtendedControls;assembly=MECF.Framework.UI.Core"
             xmlns:diag="clr-namespace:System.Diagnostics;assembly=WindowsBase"
             xmlns:micro="clr-namespace:Caliburn.Micro"
             xmlns:rtinfo="clr-namespace:MECF.Framework.Common.Aitex.Core.RT.EMS;assembly=MECF.Framework.Common"
             xmlns:deviceControl="clr-namespace:Aitex.Core.UI.DeviceControl;assembly=MECF.Framework.UI.Core"
             xmlns:core="clr-namespace:System;assembly=mscorlib"
             d:DesignHeight="1024"
             d:DesignWidth="1900"
             mc:Ignorable="d">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="MenuItem.xaml" />
            </ResourceDictionary.MergedDictionaries>
            <local:BooleanToUIColorConverter x:Key="maintainSelectedToUIColorConverter" FalseColor="DarkGray" TrueColor="Orange"/>

            <Style x:Key="listboxitem" TargetType="{x:Type ListBoxItem}">
                <Setter Property="Background" Value="Transparent" />
                <Setter Property="Margin" Value="0" />
                <Setter Property="Padding" Value="0" />
                <Setter Property="BorderThickness" Value="0" />
                <Setter Property="Rectangle.StrokeThickness" Value="3" />
                <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
                <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
            </Style>
            
            <core:Double x:Key="text_fontsize_min">20</core:Double>
            <core:Double x:Key="text_fontsize_max">25</core:Double>

            <Storyboard x:Key="highlightItem">
                <DoubleAnimation By="30" Duration="0:0:0.4" Storyboard.TargetName="border" Storyboard.TargetProperty="Width" />
                <DoubleAnimation From="{StaticResource text_fontsize_min}" To="{StaticResource text_fontsize_max}" Duration="0:0:0.4" Storyboard.TargetName="text" Storyboard.TargetProperty="FontSize" />
                <ColorAnimation From="LightGray" To="#FF57A3D4" Duration="0:0:0.4" Storyboard.TargetName="border" Storyboard.TargetProperty="Background.(Color)"/>
            </Storyboard>
            <Storyboard x:Key="dishighlightItem">
                <DoubleAnimation By="-30" Duration="0:0:0.4" Storyboard.TargetName="border" Storyboard.TargetProperty="Width" />
                <DoubleAnimation From="{StaticResource text_fontsize_max}" To="{StaticResource text_fontsize_min}" Duration="0:0:0.4" Storyboard.TargetName="text" Storyboard.TargetProperty="FontSize" />
                <ColorAnimation From="#FF57A3D4" To="LightGray" Duration="0:0:0.4" Storyboard.TargetName="border" Storyboard.TargetProperty="Background.(Color)"/>
            </Storyboard>

            <Style x:Key="border_style" TargetType="Border">
                <Setter Property="Width" Value="360"/>
                <Setter Property="CornerRadius" Value="4"/>
                <Setter Property="BorderThickness" Value="2"/>
                <Setter Property="Margin" Value="10"/>
                <Setter Property="Background" Value="LightGray"/>
            </Style>
            <DataTemplate x:Key="plantemplate" DataType="{x:Type rtinfo:MaintainerInfo}">
                <DataTemplate.Triggers>
                    <DataTrigger Value="True" Binding="{Binding IsSelected}">
                        <DataTrigger.EnterActions>
                            <BeginStoryboard Storyboard="{StaticResource highlightItem}" />
                        </DataTrigger.EnterActions>
                        <DataTrigger.ExitActions>
                            <BeginStoryboard Storyboard="{StaticResource dishighlightItem}" />
                        </DataTrigger.ExitActions>
                    </DataTrigger>
                </DataTemplate.Triggers>
                <Border x:Name="border" Style="{StaticResource border_style}" BorderBrush="{Binding IsSelected,Converter={StaticResource maintainSelectedToUIColorConverter}}">
                    <StackPanel Orientation="Vertical" MinWidth="200" Margin="2">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock x:Name="text" FontSize="24" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="5" Text="{Binding Module}"/>
                            <Image Margin="10 0 10 0" Source="/MECF.Framework.UI.Client;component/Resources/Images/edit.png" Stretch="Uniform" Height="20" Width="20" VerticalAlignment="Center" HorizontalAlignment="Center">
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="MouseLeftButtonUp">
                                        <micro:ActionMessage MethodName="MaintainerSetting">
                                            <micro:Parameter Value="{Binding }" />
                                        </micro:ActionMessage>
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Image>
                            <Image Margin="10 0 10 0" Source="/MECF.Framework.UI.Client;component/Resources/Images/close.png" Stretch="Uniform" Height="20" Width="20" VerticalAlignment="Center" HorizontalAlignment="Center">
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="MouseLeftButtonUp">
                                        <micro:ActionMessage MethodName="MaintainerDelete">
                                            <micro:Parameter Value="{Binding }" />
                                        </micro:ActionMessage>
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Image>
                        </StackPanel>

                        <TextBlock Margin="30 10 10 10" Text="{Binding Description}" FontSize="15" HorizontalAlignment="Center" TextAlignment="Center" TextWrapping="Wrap"/>
                        <StackPanel Orientation="Horizontal" Margin="2">
                            <TextBlock Text="Type:" HorizontalAlignment="Left" FontSize="15"/>
                            <TextBlock Text="{Binding ShortType}" HorizontalAlignment="Left" FontSize="15"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" Margin="5">
                            <TextBlock Text="Enabled:" HorizontalAlignment="Left" FontSize="15"/>
                            <deviceControl:AITSensor Width="20" Height="20" IsCustomRender ="True" HorizontalAlignment="Center" VerticalAlignment="Center" EnableToolTip="False" CustomColorOn="LawnGreen" CustomColorOff="Gray" LightOnValue="{Binding Enable}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" Margin="2">
                            <TextBlock Text="StartDate:" HorizontalAlignment="Left" FontSize="15"/>
                            <TextBlock Text="{Binding StartDate}" FontSize="15"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" Margin="2">
                            <TextBlock Text="Condition:" HorizontalAlignment="Left" FontSize="15"/>
                            <TextBlock Text="{Binding Threshold,StringFormat={}{0:F2}}" FontSize="15"/>
                            <TextBlock Text="{Binding TimeDisplayUnit}" HorizontalAlignment="Left" FontSize="15"/>
                        </StackPanel>
                    </StackPanel>
                </Border>
            </DataTemplate>

            <DataTemplate x:Key="pmtemplate" DataType="{x:Type rtinfo:MaintainerInfo}">
                <DataTemplate.Triggers>
                    <DataTrigger Value="True" Binding="{Binding IsSelected}">
                        <DataTrigger.EnterActions>
                            <BeginStoryboard Storyboard="{StaticResource highlightItem}" />
                        </DataTrigger.EnterActions>
                        <DataTrigger.ExitActions>
                            <BeginStoryboard Storyboard="{StaticResource dishighlightItem}" />
                        </DataTrigger.ExitActions>
                    </DataTrigger>
                </DataTemplate.Triggers>
                <Border x:Name="border" Style="{StaticResource border_style}" BorderBrush="{Binding IsSelected,Converter={StaticResource maintainSelectedToUIColorConverter}}">
                    <StackPanel Orientation="Vertical" MinWidth="200" Margin="2">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock x:Name="text" FontSize="24" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="5" Text="{Binding Module}"/>
                            <Image Margin="10 0 10 0" Source="/MECF.Framework.UI.Client;component/Resources/Images/edit.png" Stretch="Uniform" Height="20" Width="20" VerticalAlignment="Center" HorizontalAlignment="Center">
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="MouseLeftButtonUp">
                                        <micro:ActionMessage MethodName="MaintainerSetting">
                                            <micro:Parameter Value="{Binding }" />
                                        </micro:ActionMessage>
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Image>
                            <Image Margin="10 0 10 0" Source="/MECF.Framework.UI.Client;component/Resources/Images/close.png" Stretch="Uniform" Height="20" Width="20" VerticalAlignment="Center" HorizontalAlignment="Center">
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="MouseLeftButtonUp">
                                        <micro:ActionMessage MethodName="MaintainerDelete">
                                            <micro:Parameter Value="{Binding }" />
                                        </micro:ActionMessage>
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Image>
                        </StackPanel>
                        <TextBlock Margin="30 10 10 10" Text="{Binding Description}" FontSize="15" HorizontalAlignment="Center" TextAlignment="Center" TextWrapping="Wrap"/>
                        <StackPanel Orientation="Horizontal" Margin="2">
                            <TextBlock Text="Type:" HorizontalAlignment="Left" FontSize="15"/>
                            <TextBlock Text="{Binding ShortType}" HorizontalAlignment="Left" FontSize="15"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" Margin="5">
                            <TextBlock Text="Enabled:" HorizontalAlignment="Left" FontSize="15"/>
                            <deviceControl:AITSensor Width="20" Height="20" IsCustomRender ="True" HorizontalAlignment="Center" VerticalAlignment="Center" EnableToolTip="False" CustomColorOn="LawnGreen" CustomColorOff="Gray" LightOnValue="{Binding Enable}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" Margin="2">
                            <TextBlock Text="StartDate:" HorizontalAlignment="Left" FontSize="15"/>
                            <TextBlock Text="{Binding StartDate}" FontSize="15"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" Margin="2">
                            <TextBlock Text="Condition:" HorizontalAlignment="Left" FontSize="15"/>
                            <TextBlock Text="{Binding Threshold,StringFormat={}{0:F2}}" FontSize="15"/>
                            <TextBlock Text="{Binding TimeDisplayUnit}" HorizontalAlignment="Left" FontSize="15"/>
                        </StackPanel>
                    </StackPanel>
                </Border>
            </DataTemplate>

            <DataTemplate x:Key="pmcoatingtemplate" DataType="{x:Type rtinfo:MaintainerInfo}">
                <DataTemplate.Triggers>
                    <DataTrigger Value="True" Binding="{Binding IsSelected}">
                        <DataTrigger.EnterActions>
                            <BeginStoryboard Storyboard="{StaticResource highlightItem}" />
                        </DataTrigger.EnterActions>
                        <DataTrigger.ExitActions>
                            <BeginStoryboard Storyboard="{StaticResource dishighlightItem}" />
                        </DataTrigger.ExitActions>
                    </DataTrigger>
                </DataTemplate.Triggers>
                <Border x:Name="border" Style="{StaticResource border_style}" BorderBrush="{Binding IsSelected,Converter={StaticResource maintainSelectedToUIColorConverter}}">
                    <StackPanel Orientation="Vertical" MinWidth="200" Margin="2">
                        <StackPanel Orientation="Horizontal">
                            <TextBlock x:Name="text" FontSize="24" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="5" Text="{Binding Module}"/>
                            <Image Margin="10 0 10 0" Source="/MECF.Framework.UI.Client;component/Resources/Images/edit.png" Stretch="Uniform" Height="20" Width="20" VerticalAlignment="Center" HorizontalAlignment="Center">
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="MouseLeftButtonUp">
                                        <micro:ActionMessage MethodName="MaintainerSetting">
                                            <micro:Parameter Value="{Binding }" />
                                        </micro:ActionMessage>
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Image>
                            <Image Margin="10 0 10 0" Source="/MECF.Framework.UI.Client;component/Resources/Images/close.png" Stretch="Uniform" Height="20" Width="20" VerticalAlignment="Center" HorizontalAlignment="Center">
                                <i:Interaction.Triggers>
                                    <i:EventTrigger EventName="MouseLeftButtonUp">
                                        <micro:ActionMessage MethodName="MaintainerDelete">
                                            <micro:Parameter Value="{Binding }" />
                                        </micro:ActionMessage>
                                    </i:EventTrigger>
                                </i:Interaction.Triggers>
                            </Image>
                        </StackPanel>
                        <TextBlock Margin="30 10 10 10" Text="{Binding Description}" FontSize="15" HorizontalAlignment="Center" TextAlignment="Center" TextWrapping="Wrap"/>
                        <StackPanel Orientation="Horizontal" Margin="2">
                            <TextBlock Text="Type:" HorizontalAlignment="Left" FontSize="15"/>
                            <TextBlock Text="{Binding ShortType}" HorizontalAlignment="Left" FontSize="15"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" Margin="5">
                            <TextBlock Text="Enabled:" HorizontalAlignment="Left" FontSize="15"/>
                            <deviceControl:AITSensor Width="20" Height="20" IsCustomRender ="True" HorizontalAlignment="Center" VerticalAlignment="Center" EnableToolTip="False" CustomColorOn="LawnGreen" CustomColorOff="Gray" LightOnValue="{Binding Enable}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" Margin="2">
                            <TextBlock Text="StartDate:" HorizontalAlignment="Left" FontSize="15"/>
                            <TextBlock Text="{Binding StartDate}" FontSize="15"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" Margin="2">
                            <TextBlock Text="Condition:" HorizontalAlignment="Left" FontSize="15"/>
                            <TextBlock Text="{Binding Threshold,StringFormat={}{0:F2}}" FontSize="15"/>
                            <TextBlock Text="mm" HorizontalAlignment="Left" FontSize="15"/>
                        </StackPanel>
                    </StackPanel>
                </Border>
            </DataTemplate>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="520"/>
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Grid Grid.Column="0" Margin="5">
            <Grid.RowDefinitions>
                <RowDefinition Height="40"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Grid Grid.Row="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="70" />
                    <ColumnDefinition Width="70" />
                    <ColumnDefinition Width="70" />
                </Grid.ColumnDefinitions>
                <TextBlock Grid.Column="0" Text="Maintenance Groups" FontSize="24" HorizontalAlignment="Center" VerticalAlignment="Center"/>
                <Button Grid.Column="2" Margin="5" Height="30" Width="60" Cursor="Hand" Content="Add" HorizontalAlignment="Center">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <micro:ActionMessage MethodName="AddNewPlan"/>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Button>
                <Button Grid.Column="3" Margin="5" Height="30" Width="60" Cursor="Hand" Content="Edit" HorizontalAlignment="Center">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <micro:ActionMessage MethodName="MaintainerSetting">
                                <micro:Parameter Value="{Binding SelectedValue}" />
                            </micro:ActionMessage>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Button>
                <Button Grid.Column="4" Margin="5" Height="30" Width="60" Cursor="Hand" Content="Delete" HorizontalAlignment="Center">
                    <i:Interaction.Triggers>
                        <i:EventTrigger EventName="Click">
                            <micro:ActionMessage MethodName="MaintainerDelete">
                                <micro:Parameter Value="{Binding SelectedValue}" />
                            </micro:ActionMessage>
                        </i:EventTrigger>
                    </i:Interaction.Triggers>
                </Button>
            </Grid>
            <TabControl Grid.Row="1" BorderThickness="3" ItemsSource="{Binding MaintainerInfoDic}" SelectedValue="{Binding SelectedKeyValue}">
                <i:Interaction.Triggers>
                    <i:EventTrigger EventName="SelectionChanged">
                        <micro:ActionMessage MethodName="SelectionChanged"/>
                    </i:EventTrigger>
                </i:Interaction.Triggers>
                <TabControl.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock FontWeight="Bold" Text="{Binding Key}" FontSize="20"/>
                        </StackPanel>
                    </DataTemplate>
                </TabControl.ItemTemplate>
                <TabControl.ContentTemplate>
                    <DataTemplate>
                        <ListBox x:Name="listbox" ItemsSource="{Binding Value}" SelectedValue="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl},Path=DataContext.SelectedValue}" ItemContainerStyle="{StaticResource listboxitem}">
                            <i:Interaction.Behaviors>
                                <behavior:ItemChangedTargetItemChangedBehavior Target="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=UserControl},Path=DataContext.MaintainerItemConfigEnableInfos}" TargetListBox="{Binding ElementName=listbox}"/>
                            </i:Interaction.Behaviors>
                            <ListBox.ItemTemplateSelector>
                                <local:MaintainerDataTemplateSelector PlanMaintainerTemplate ="{StaticResource plantemplate}" PMMaintainerTemplate ="{StaticResource pmtemplate}" PMCoatingMaintainerTemplate="{StaticResource pmcoatingtemplate}"/>
                            </ListBox.ItemTemplateSelector>
                        </ListBox>
                    </DataTemplate>
                </TabControl.ContentTemplate>
                
            </TabControl>
        </Grid>
        
        <Grid Grid.Column="1" Margin="5">
            <Grid.RowDefinitions>
                <RowDefinition Height="60"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="40"/>
            </Grid.RowDefinitions>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="auto" />
                </Grid.ColumnDefinitions>
                <StackPanel Grid.Column="1" Orientation="Horizontal" HorizontalAlignment="Right">
                    <Button Grid.Column="1" Margin="5" Height="30" Width="60" Cursor="Hand" Content="Add">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="Click">
                                <micro:ActionMessage MethodName="AddNewItem"/>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </Button>
                    <Button Grid.Column="1" Margin="5" Height="30" Width="60" Cursor="Hand" Content="Edit">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="Click">
                                <micro:ActionMessage MethodName="ItemSetting">
                                    <micro:Parameter Value="{Binding SelectedItem,ElementName=datagrid}" />
                                </micro:ActionMessage>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </Button>
                    <Button Grid.Column="1" Margin="5" Height="30" Width="60" Cursor="Hand" Content="Delete">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="Click">
                                <micro:ActionMessage MethodName="MaintainItemDelete">
                                    <micro:Parameter Value="{Binding SelectedItem,ElementName=datagrid}" />
                                </micro:ActionMessage>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </Button>
                </StackPanel>
            </Grid>
            <DataGrid x:Name="datagrid" Grid.Row="1" HorizontalAlignment="Stretch" AutoGenerateColumns="False" CanUserAddRows="False" HorizontalScrollBarVisibility="Auto" RowHeaderWidth="0" SelectionMode="Extended" SelectionUnit="FullRow"
          ItemsSource="{Binding ObMaintainerItemConfigEnableInfos}" VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.VirtualizationMode="Recycling">
                <i:Interaction.Behaviors>
                    <behavior:DataGridSelectionChangedScrollChangedBehavior/>
                </i:Interaction.Behaviors>
                <DataGrid.Columns>
                    <DataGridTemplateColumn Width="Auto" MinWidth="60" Header="index">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate DataType="{x:Type local:MaintainerItemConfigEnableInfo}">
                                <TextBlock Margin="5,0" HorizontalAlignment="Left" VerticalAlignment="Center" FontFamily="Arial" FontSize="14" Text="{Binding Config.Index}" TextWrapping="Wrap"/>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Width="Auto" MinWidth="60" Header="UID">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate DataType="{x:Type local:MaintainerItemConfigEnableInfo}">
                                <TextBlock Margin="5,0" HorizontalAlignment="Left" VerticalAlignment="Center" FontFamily="Arial" FontSize="14" Text="{Binding Config.UID}" TextWrapping="Wrap"/>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Width="Auto" MinWidth="150" Header="Item">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate DataType="{x:Type local:MaintainerItemConfigEnableInfo}">
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Margin="5,0" HorizontalAlignment="Left" VerticalAlignment="Center" FontFamily="Arial" FontSize="14" Text="{Binding Config.ParentName}" TextWrapping="Wrap"/>
                                </StackPanel>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Width="Auto" MinWidth="150" Header="Name">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate DataType="{x:Type local:MaintainerItemConfigEnableInfo}">
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition/>
                                        <ColumnDefinition/>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Grid.Column="0" Margin="5,0" HorizontalAlignment="Left" VerticalAlignment="Center"
                                   FontFamily="Arial" FontSize="14" Text="{Binding Config.Name}" TextWrapping="Wrap"/>

                                </Grid>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Width="Auto" MinWidth="400" Header="Description">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate DataType="{x:Type local:MaintainerItemConfigEnableInfo}">
                                <TextBlock Margin="5,0" HorizontalAlignment="Left" VerticalAlignment="Center" FontFamily="Arial"
                               FontSize="14" Text="{Binding Config.Description}" TextWrapping="Wrap"/>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Width="Auto" MinWidth="400" Header="DefaultRecord">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate DataType="{x:Type local:MaintainerItemConfigEnableInfo}">
                                <TextBlock Margin="5,0" HorizontalAlignment="Left" VerticalAlignment="Center" FontFamily="Arial"
   FontSize="14" Text="{Binding Config.DefaultRecord}" TextWrapping="Wrap"/>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Width="Auto" MinWidth="150" Header="File">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate DataType="{x:Type local:MaintainerItemConfigEnableInfo}">
                                <TextBlock Margin="5,0" HorizontalAlignment="Left" VerticalAlignment="Center" FontFamily="Arial" 
                                FontSize="14" Text="{Binding Config.FilePath}" TextWrapping="Wrap"/>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Width="Auto" MinWidth="60" Header="Enabled">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <CheckBox Margin="5,0,5,0" HorizontalAlignment="Center" Height="25" Width="25" VerticalAlignment="Center" FontFamily="Arial" FontSize="18" IsChecked="{Binding SelectedPage.Value}">
                                    <i:Interaction.Triggers>
                                        <i:EventTrigger EventName="Click">
                                            <micro:ActionMessage MethodName="ItemCheckedChanged">
                                                <micro:Parameter Value="{Binding SelectedPage}" />
                                                <micro:Parameter Value="{Binding Config.UID}" />
                                            </micro:ActionMessage>
                                        </i:EventTrigger>
                                    </i:Interaction.Triggers>
                                </CheckBox>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Width="Auto" MinWidth="150">
                        <DataGridTemplateColumn.HeaderTemplate>
                            <DataTemplate>
                                <Grid Width="80">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="40"/>
                                        <ColumnDefinition Width="*"/>
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Grid.Column="0" Text="Edit" HorizontalAlignment="Left" VerticalAlignment="Center"/>
                                    <Button Grid.Column="1" Background="Transparent" Width="60" BorderBrush="Transparent" BorderThickness="0">
                                        <i:Interaction.Triggers>
                                            <i:EventTrigger EventName="Click">
                                                <micro:ActionMessage MethodName="AddNewItem"/>
                                            </i:EventTrigger>
                                        </i:Interaction.Triggers>
                                        <Button.Style>
                                            <Style TargetType="Button">
                                                <Style.Triggers>
                                                    <Trigger Property="IsMouseOver" Value="True">
                                                        <Setter Property="Background" Value="Transparent"/>
                                                        <Setter Property="BorderBrush" Value="Transparent"/>
                                                    </Trigger>
                                                </Style.Triggers>
                                            </Style>
                                        </Button.Style>
                                        <Button.ContentTemplate>
                                            <DataTemplate>
                                                <StackPanel Orientation="Horizontal">
                                                    <Image Source="/MECF.Framework.UI.Client;component/Resources/Images/add.png" Stretch="Uniform" Width="20" Height="20"/>
                                                </StackPanel>
                                            </DataTemplate>
                                        </Button.ContentTemplate>
                                    </Button>
                                </Grid>
                            </DataTemplate>
                        </DataGridTemplateColumn.HeaderTemplate>
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate DataType="{x:Type local:MaintainerItemConfigEnableInfo}">
                                <StackPanel Orientation="Horizontal">
                                    <Image Margin="10 0 10 0" Source="/MECF.Framework.UI.Client;component/Resources/Images/up.png" Stretch="Uniform" Height="25" Width="25" VerticalAlignment="Center" HorizontalAlignment="Center">
                                        <i:Interaction.Triggers>
                                            <i:EventTrigger EventName="MouseLeftButtonUp">
                                                <micro:ActionMessage MethodName="MaintainItemUp">
                                                    <micro:Parameter Value="{Binding }"/>
                                                </micro:ActionMessage>
                                            </i:EventTrigger>
                                        </i:Interaction.Triggers>
                                    </Image>
                                    <Image Margin="10 0 10 0" Source="/MECF.Framework.UI.Client;component/Resources/Images/down.png" Stretch="Uniform" Height="25" Width="25" VerticalAlignment="Center" HorizontalAlignment="Center">
                                        <i:Interaction.Triggers>
                                            <i:EventTrigger EventName="MouseLeftButtonUp">
                                                <micro:ActionMessage MethodName="MaintainItemDown">
                                                    <micro:Parameter Value="{Binding }" />
                                                </micro:ActionMessage>
                                            </i:EventTrigger>
                                        </i:Interaction.Triggers>
                                    </Image>
                                    <Image Margin="10 0 10 0" Source="/MECF.Framework.UI.Client;component/Resources/Images/edit.png" Stretch="Uniform" Height="20" Width="20" VerticalAlignment="Center" HorizontalAlignment="Center">
                                        <i:Interaction.Triggers>
                                            <i:EventTrigger EventName="MouseLeftButtonUp">
                                                <micro:ActionMessage MethodName="ItemSetting">
                                                    <micro:Parameter Value="{Binding }" />
                                                </micro:ActionMessage>
                                            </i:EventTrigger>
                                        </i:Interaction.Triggers>
                                    </Image>
                                    <Image Margin="10 0 10 0" Source="/MECF.Framework.UI.Client;component/Resources/Images/close.png" Stretch="Uniform" Height="20" Width="20" VerticalAlignment="Center" HorizontalAlignment="Center">
                                        <i:Interaction.Triggers>
                                            <i:EventTrigger EventName="MouseLeftButtonUp">
                                                <micro:ActionMessage MethodName="MaintainItemDelete">
                                                    <micro:Parameter Value="{Binding }" />
                                                </micro:ActionMessage>
                                            </i:EventTrigger>
                                        </i:Interaction.Triggers>
                                    </Image>
                                </StackPanel>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                </DataGrid.Columns>
            </DataGrid>
            <Grid Grid.Row="2" Margin="5">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <StackPanel Grid.Column="1" Orientation ="Horizontal">
                    <Button Content="Previous" Margin="10 0 10 0" Width="80">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="Click">
                                <micro:ActionMessage MethodName="Previous"/>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </Button>
                    <TextBlock Margin="10 0 10 0" VerticalAlignment="Center">
<Run Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type UserControl}},Path=DataContext.CurrentPage}" FontSize="14" Typography.Variants="Subscript"/><Run Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type UserControl}},Path=DataContext.TotalPage,StringFormat=/{0}}" FontSize="12" Typography.Variants="Subscript"/>
                    </TextBlock>
                    <Button Content="Next" Margin="10 0 10 0" Width="80">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="Click">
                                <micro:ActionMessage MethodName="Next"/>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </Button>
                </StackPanel>
            </Grid>

        </Grid>
    </Grid>
</UserControl>
