<?xml version="1.0" encoding="utf-8"?>
<UserControl x:Class="QC.QTMApplication.TTDParameterView" 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:sys="clr-namespace:System;assembly=mscorlib" xmlns:local="clr-namespace:QC.QTMApplication" x:Name="TTdParamViewUserControl">
  <FrameworkElement.Resources>
    <ResourceDictionary>
      <LinearGradientBrush x:Key="GridHeader" EndPoint="0.5,1" StartPoint="0.5,0">
        <GradientStop Color="White" Offset="0.0" />
        <GradientStop Color="#FFBECA98" Offset="0.6" />
      </LinearGradientBrush>
      <Color x:Key="HeaderBackgroundColor">#FFEEF4D3</Color>
      <local:BoolToVisibilityConverter x:Key="boolToVisibilityConverter" />
      <Style x:Key="{x:Type ToolTip}" TargetType="{x:Type ToolTip}">
        <Setter Property="Visibility" Value="Visible" />
        <Style.Triggers>
          <DataTrigger Binding="{Binding Path=Content, RelativeSource={RelativeSource Self}}" Value="{x:Null}">
            <Setter Property="Visibility" Value="Collapsed" />
          </DataTrigger>
          <DataTrigger Value="" Binding="{Binding Path=Content, RelativeSource={RelativeSource Self}}">
            <Setter Property="Visibility" Value="Collapsed" />
          </DataTrigger>
        </Style.Triggers>
      </Style>
      <Style x:Key="{x:Type DataGridColumnHeader}" TargetType="{x:Type DataGridColumnHeader}">
        <Setter Property="Background" Value="{DynamicResource GridHeader}" />
        <Setter Property="BorderBrush" Value="#FF000000" />
        <Setter Property="BorderThickness" Value="0,0,1,0" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="Padding" Value="2" />
      </Style>
      <DataTemplate x:Key="RowDetailVisibilityToggleButton">
        <ToggleButton IsChecked="{Binding Path=DetailsVisibility, Mode=TwoWay, RelativeSource={RelativeSource AncestorType=DataGridRow}, Converter={StaticResource boolToVisibilityConverter}}" Visibility="{Binding HasChildren, Mode=OneWay, Converter={StaticResource boolToVisibilityConverter}}">
          <FrameworkElement.Style>
            <Style TargetType="{x:Type ToggleButton}">
              <Setter Property="Content" Value="+" />
              <Style.Triggers>
                <Trigger Property="ToggleButton.IsChecked" Value="True">
                  <Setter Property="Content" Value="-" />
                </Trigger>
              </Style.Triggers>
            </Style>
          </FrameworkElement.Style>
        </ToggleButton>
      </DataTemplate>
      <Style x:Key="{x:Type HeaderedContentControl}" TargetType="{x:Type HeaderedContentControl}">
        <Setter Property="Template">
          <Setter.Value>
            <ControlTemplate TargetType="{x:Type HeaderedContentControl}">
              <Grid>
                <Grid.RowDefinitions>
                  <RowDefinition Height="Auto" />
                  <RowDefinition Height="*" />
                </Grid.RowDefinitions>
                <ContentControl Content="{TemplateBinding HeaderedContentControl.Header}" Grid.Row="0" />
                <ContentControl Content="{TemplateBinding ContentControl.Content}" Grid.Row="1" />
              </Grid>
            </ControlTemplate>
          </Setter.Value>
        </Setter>
      </Style>
      <Style x:Key="{x:Type DataGrid}" TargetType="{x:Type DataGrid}">
        <Setter Property="FontFamily" Value="Microsoft Sans Serif" />
        <Setter Property="FontSize" Value="11" />
        <Setter Property="FontStyle" Value="Normal" />
        <Setter Property="DataGrid.RowHeight" Value="20" />
        <Setter Property="Background">
          <Setter.Value>
            <SolidColorBrush Color="{DynamicResource HeaderBackgroundColor}" />
          </Setter.Value>
        </Setter>
      </Style>
      <DataTemplate x:Key="ValidationErrorTemplate">
        <DockPanel>
          <TextBlock Foreground="#FFFF0000" FontSize="20" Text="!">
            <FrameworkElement.Style>
              <Style TargetType="{x:Type TextBlock}">
                <Style.Triggers>
                  <DataTrigger Value="true" Binding="{Binding HasGvGetValue}">
                    <Setter Property="Background" Value="#FFFFFF00" />
                    <Setter Property="FrameworkElement.ToolTip" Value="This value will be overwritten by the global variable specified in the GV Get column" />
                  </DataTrigger>
                </Style.Triggers>
              </Style>
            </FrameworkElement.Style>
          </TextBlock>
          <AdornedElementPlaceholder />
        </DockPanel>
      </DataTemplate>
      <DataTemplate x:Key="FileValueEditCellTemplate">
        <Grid>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
          </Grid.ColumnDefinitions>
          <TextBox Grid.Column="0" Text="{Binding Value, UpdateSourceTrigger=PropertyChanged}" IsReadOnly="{Binding IsParamReadOnly}">
            <FrameworkElement.Style>
              <Style TargetType="{x:Type TextBox}">
                <Style.Triggers>
                  <DataTrigger Value="true" Binding="{Binding HasDifferentValues}">
                    <Setter Property="Background" Value="#FFB0C4DE" />
                  </DataTrigger>
                  <DataTrigger Value="true" Binding="{Binding HasGvGetValue}">
                    <Setter Property="Background" Value="#FFFFFF00" />
                    <Setter Property="FrameworkElement.ToolTip" Value="This value will be overwritten by the global variable specified in the GV Get column" />
                  </DataTrigger>
                </Style.Triggers>
              </Style>
            </FrameworkElement.Style>
          </TextBox>
          <Button Grid.Column="1" Content="   " Tag="{Binding}" IsEnabled="{Binding IsParamEditable}" Click="FileValueEditCellTemplateButton_Click" />
        </Grid>
      </DataTemplate>
      <DataTemplate x:Key="MultilineEditCellTemplate">
        <TextBox Text="{Binding Value, UpdateSourceTrigger=PropertyChanged}" IsReadOnly="{Binding IsParamReadOnly}" PreviewMouseUp="ValueEditCell_PreviewMouseUp">
          <FrameworkElement.Style>
            <Style TargetType="{x:Type TextBox}">
              <Style.Triggers>
                <DataTrigger Value="true" Binding="{Binding HasDifferentValues}">
                  <Setter Property="Background" Value="#FFB0C4DE" />
                </DataTrigger>
                <DataTrigger Value="true" Binding="{Binding HasGvGetValue}">
                  <Setter Property="Background" Value="#FFFFFF00" />
                  <Setter Property="FrameworkElement.ToolTip" Value="This value will be overwritten by the global variable specified in the GV Get column" />
                </DataTrigger>
              </Style.Triggers>
            </Style>
          </FrameworkElement.Style>
        </TextBox>
      </DataTemplate>
      <DataTemplate x:Key="DefaultValueEditCellTemplate">
        <TextBox IsReadOnly="{Binding IsParamReadOnly}" Text="{Binding Path=Value, UpdateSourceTrigger=PropertyChanged}">
          <FrameworkElement.Style>
            <Style TargetType="{x:Type TextBox}">
              <Style.Triggers>
                <DataTrigger Value="true" Binding="{Binding HasDifferentValues}">
                  <Setter Property="Background" Value="#FFB0C4DE" />
                </DataTrigger>
                <DataTrigger Value="true" Binding="{Binding HasGvGetValue}">
                  <Setter Property="Background" Value="#FFFFFF00" />
                  <Setter Property="FrameworkElement.ToolTip" Value="This value will be overwritten by the global variable specified in the GV Get column" />
                </DataTrigger>
              </Style.Triggers>
            </Style>
          </FrameworkElement.Style>
        </TextBox>
      </DataTemplate>
      <DataTemplate x:Key="DefaultOutputValueEditCellTemplate">
        <TextBox IsReadOnly="True" Text="{Binding Value}">
          <FrameworkElement.Style>
            <Style TargetType="{x:Type TextBox}">
              <Style.Triggers>
                <DataTrigger Value="true" Binding="{Binding HasGvGetValue}">
                  <Setter Property="Background" Value="#FFFFFF00" />
                  <Setter Property="FrameworkElement.ToolTip" Value="This value will be overwritten by the global variable specified in the GV Get column" />
                </DataTrigger>
              </Style.Triggers>
            </Style>
          </FrameworkElement.Style>
        </TextBox>
      </DataTemplate>
      <DataTemplate x:Key="InputParameterArrayCellEditTemplate">
        <Grid>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
          </Grid.ColumnDefinitions>
          <TextBox Grid.Column="0" Text="{Binding Value, UpdateSourceTrigger=PropertyChanged}" IsReadOnly="{Binding IsParamReadOnly}">
            <FrameworkElement.Style>
              <Style TargetType="{x:Type TextBox}">
                <Style.Triggers>
                  <DataTrigger Value="true" Binding="{Binding HasDifferentValues}">
                    <Setter Property="Background" Value="#FFB0C4DE" />
                  </DataTrigger>
                  <DataTrigger Value="true" Binding="{Binding HasGvGetValue}">
                    <Setter Property="Background" Value="#FFFFFF00" />
                    <Setter Property="FrameworkElement.ToolTip" Value="This value will be overwritten by the global variable specified in the GV Get column" />
                  </DataTrigger>
                </Style.Triggers>
              </Style>
            </FrameworkElement.Style>
          </TextBox>
          <Button Grid.Column="1" Content="   " Tag="{Binding}" IsEnabled="{Binding IsParamEditable}" Click="ParameterArrayCellEditTemplateButton_Click" />
        </Grid>
      </DataTemplate>
      <DataTemplate x:Key="OutputParameterArrayCellEditTemplate">
        <Grid>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
          </Grid.ColumnDefinitions>
          <TextBox Grid.Column="0" IsReadOnly="True" Text="{Binding Value}">
            <FrameworkElement.Style>
              <Style TargetType="{x:Type TextBox}">
                <Style.Triggers>
                  <DataTrigger Value="true" Binding="{Binding HasGvGetValue}">
                    <Setter Property="Background" Value="#FFFFFF00" />
                    <Setter Property="FrameworkElement.ToolTip" Value="This value will be overwritten by the global variable specified in the GV Get column" />
                  </DataTrigger>
                </Style.Triggers>
              </Style>
            </FrameworkElement.Style>
          </TextBox>
          <Button Grid.Column="1" Content="   " Tag="{Binding}" IsEnabled="{Binding IsParamEditable}" Click="ParameterArrayCellEditTemplateButton_Click" />
        </Grid>
      </DataTemplate>
      <DataTemplate x:Key="InputParameterDataTableCellEditTemplate">
        <Grid>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
          </Grid.ColumnDefinitions>
          <TextBox Grid.Column="0" Text="{Binding Value, UpdateSourceTrigger=PropertyChanged}" IsReadOnly="{Binding IsParamReadOnly}">
            <FrameworkElement.Style>
              <Style TargetType="{x:Type TextBox}">
                <Style.Triggers>
                  <DataTrigger Value="true" Binding="{Binding HasDifferentValues}">
                    <Setter Property="Background" Value="#FFB0C4DE" />
                  </DataTrigger>
                  <DataTrigger Value="true" Binding="{Binding HasGvGetValue}">
                    <Setter Property="Background" Value="#FFFFFF00" />
                    <Setter Property="FrameworkElement.ToolTip" Value="This value will be overwritten by the global variable specified in the GV Get column" />
                  </DataTrigger>
                </Style.Triggers>
              </Style>
            </FrameworkElement.Style>
          </TextBox>
          <Button Grid.Column="1" Content="   " Tag="{Binding}" IsEnabled="{Binding IsParamEditable}" Click="ParameterDataTableCellEditTemplateButton_Click" />
        </Grid>
      </DataTemplate>
      <DataTemplate x:Key="OutputParameterDataTableCellEditTemplate">
        <Grid>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
          </Grid.ColumnDefinitions>
          <TextBox Grid.Column="0" IsReadOnly="True" Text="{Binding Value}">
            <FrameworkElement.Style>
              <Style TargetType="{x:Type TextBox}">
                <Style.Triggers>
                  <DataTrigger Value="true" Binding="{Binding HasGvGetValue}">
                    <Setter Property="Background" Value="#FFFFFF00" />
                    <Setter Property="FrameworkElement.ToolTip" Value="This value will be overwritten by the global variable specified in the GV Get column" />
                  </DataTrigger>
                </Style.Triggers>
              </Style>
            </FrameworkElement.Style>
          </TextBox>
          <Button Grid.Column="1" Content="   " Tag="{Binding}" IsEnabled="{Binding IsParamEditable}" Click="ParameterDataTableCellEditTemplateButton_Click" />
        </Grid>
      </DataTemplate>
      <DataTemplate x:Key="GVSetEditCellTemplate">
        <Grid>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
          </Grid.ColumnDefinitions>
          <TextBox Grid.Column="0" Text="{Binding GV_Set, UpdateSourceTrigger=PropertyChanged}" IsReadOnly="{Binding IsParamReadOnly}" />
          <Button Grid.Column="1" Content="   " Tag="{Binding}" IsEnabled="{Binding IsParamEditable}" Click="GVSetEditCellTemplateButton_Click" />
        </Grid>
      </DataTemplate>
      <DataTemplate x:Key="GVGetEditCellTemplate">
        <Grid>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
          </Grid.ColumnDefinitions>
          <TextBox Grid.Column="0" Text="{Binding GV_Get, UpdateSourceTrigger=PropertyChanged}" IsReadOnly="{Binding IsParamReadOnly}" />
          <Button Grid.Column="1" Content="   " Tag="{Binding}" IsEnabled="{Binding IsParamEditable}" Click="GVGetEditCellTemplateButton_Click" />
        </Grid>
      </DataTemplate>
      <DataTemplate x:Key="GVGet_UL_EditCellTemplate">
        <Grid>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
          </Grid.ColumnDefinitions>
          <TextBox Grid.Column="0" Text="{Binding GV_UL_Get, UpdateSourceTrigger=PropertyChanged}" IsReadOnly="{Binding IsParamReadOnly}" />
          <Button Grid.Column="1" Content="   " Tag="{Binding}" IsEnabled="{Binding IsParamEditable}" Click="GVGet_UL_EditCellTemplateButton_Click" />
        </Grid>
      </DataTemplate>
      <DataTemplate x:Key="GVGet_LL_EditCellTemplate">
        <Grid>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
          </Grid.ColumnDefinitions>
          <TextBox Grid.Column="0" Text="{Binding GV_LL_Get, UpdateSourceTrigger=PropertyChanged}" IsReadOnly="{Binding IsParamReadOnly}" />
          <Button Grid.Column="1" Content="   " Tag="{Binding}" IsEnabled="{Binding IsParamEditable}" Click="GVGet_LL_EditCellTemplateButton_Click" />
        </Grid>
      </DataTemplate>
      <DataTemplate x:Key="MultiLineDescriptionEditorTemplate">
        <TextBox ToolTipService.ShowDuration="60000" Text="{Binding Description, UpdateSourceTrigger=PropertyChanged}" IsReadOnly="{Binding IsParamReadOnly}" PreviewMouseUp="DescriptionEdit_PreviewMouseUp">
          <FrameworkElement.ToolTip>
            <ToolTip StaysOpen="True">
              <TextBlock TextWrapping="Wrap" Width="200" Text="{Binding Description}">
                <FrameworkElement.Style>
                  <Style TargetType="{x:Type TextBlock}">
                    <Style.Triggers>
                      <Trigger Property="Text" Value="{x:Static sys:String.Empty}">
                        <Setter Property="Visibility" Value="Collapsed" />
                      </Trigger>
                      <Trigger Property="Text" Value="{x:Null}">
                        <Setter Property="Visibility" Value="Collapsed" />
                      </Trigger>
                    </Style.Triggers>
                  </Style>
                </FrameworkElement.Style>
              </TextBlock>
            </ToolTip>
          </FrameworkElement.ToolTip>
        </TextBox>
      </DataTemplate>
      <DataTemplate x:Key="DataLoggingConditionEditCellTemplate">
        <Grid>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="Auto" />
          </Grid.ColumnDefinitions>
          <TextBlock Grid.Column="0" Text="{Binding Logging_Condition}" />
          <Button Grid.Column="1" Content="   " Tag="{Binding}" IsEnabled="{Binding IsParamEditable}" Click="DataLoggingConditionEditCellTemplateButton_Click" />
        </Grid>
      </DataTemplate>
      <DataGridTemplateColumn x:Key="dataGridParameterName" Header="Parameter Name">
        <DataGridTemplateColumn.CellTemplate>
          <DataTemplate>
            <TextBlock Text="{Binding Parameter_Name}">
              <FrameworkElement.ContextMenu>
                <ContextMenu>
                  <MenuItem Header="Copy Text" Tag="{Binding}" Click="Copy_ParameterName_Click" />
                  <MenuItem Header="Exclude Parameter Logging (Global)" Tag="{Binding}" Click="ExclueParameterLoggingGlobally_Click" />
                  <MenuItem Header="Include Parameter Logging (Global)" Tag="{Binding}" Click="InlcudeParameterLoggingGlobally_Click" />
                </ContextMenu>
              </FrameworkElement.ContextMenu>
            </TextBlock>
          </DataTemplate>
        </DataGridTemplateColumn.CellTemplate>
      </DataGridTemplateColumn>
      <DataGridTemplateColumn x:Key="dataGridParameterDataLogging" Header="Data Logging">
        <DataGridTemplateColumn.CellTemplate>
          <DataTemplate>
            <CheckBox IsThreeState="True" HorizontalAlignment="Center" VerticalAlignment="Center" IsEnabled="{Binding IsParamEditable}" IsChecked="{Binding Data_Logging, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Click="TriStateCheckBox_Click" />
          </DataTemplate>
        </DataGridTemplateColumn.CellTemplate>
      </DataGridTemplateColumn>
      <DataGridTemplateColumn x:Key="dataGridParameterReportingEnabled" Header="Reporting Enabled">
        <DataGridTemplateColumn.CellTemplate>
          <DataTemplate>
            <CheckBox IsThreeState="True" HorizontalAlignment="Center" VerticalAlignment="Center" IsEnabled="{Binding IsParamEditable}" IsChecked="{Binding Reporting_Enabled, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Click="TriStateCheckBox_Click" />
          </DataTemplate>
        </DataGridTemplateColumn.CellTemplate>
      </DataGridTemplateColumn>
      <DataGridTemplateColumn x:Key="dataGridParameterUnit" Header="Unit">
        <DataGridTemplateColumn.CellTemplate>
          <DataTemplate>
            <TextBox IsReadOnly="{Binding IsParamReadOnly}" Text="{Binding Unit, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
          </DataTemplate>
        </DataGridTemplateColumn.CellTemplate>
      </DataGridTemplateColumn>
      <DataGridTemplateColumn x:Key="dataGridParameterLL" Header="LL">
        <DataGridTemplateColumn.CellTemplate>
          <DataTemplate>
            <TextBox IsReadOnly="{Binding IsParamReadOnly}" Text="{Binding LL, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
              <FrameworkElement.Style>
                <Style TargetType="{x:Type TextBox}">
                  <Style.Triggers>
                    <DataTrigger Value="true" Binding="{Binding HasGvGetLL}">
                      <Setter Property="Background" Value="#FFFFFF00" />
                      <Setter Property="FrameworkElement.ToolTip" Value="This value will be overwritten by the global variable specified in the GV LL Get column" />
                    </DataTrigger>
                  </Style.Triggers>
                </Style>
              </FrameworkElement.Style>
            </TextBox>
          </DataTemplate>
        </DataGridTemplateColumn.CellTemplate>
      </DataGridTemplateColumn>
      <DataGridTemplateColumn x:Key="dataGridParameterUL" Header="UL">
        <DataGridTemplateColumn.CellTemplate>
          <DataTemplate>
            <TextBox IsReadOnly="{Binding IsParamReadOnly}" Text="{Binding UL, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
              <FrameworkElement.Style>
                <Style TargetType="{x:Type TextBox}">
                  <Style.Triggers>
                    <DataTrigger Value="true" Binding="{Binding HasGvGetUL}">
                      <Setter Property="Background" Value="#FFFFFF00" />
                      <Setter Property="FrameworkElement.ToolTip" Value="This value will be overwritten by the global variable specified in the GV UL Get column" />
                    </DataTrigger>
                  </Style.Triggers>
                </Style>
              </FrameworkElement.Style>
            </TextBox>
          </DataTemplate>
        </DataGridTemplateColumn.CellTemplate>
      </DataGridTemplateColumn>
      <DataTemplate x:Key="InputGrid">
        <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
          <DataGrid CanUserAddRows="False" CanUserDeleteRows="False" CanUserSortColumns="False" SelectionMode="Extended" CanUserReorderColumns="False" SelectionUnit="Cell" AutoGenerateColumns="False" RowDetailsVisibilityMode="Collapsed" GotFocus="InputDataGrid_GotFocus" RowDetailsVisibilityChanged="InputGrid_RowDetailsVisibilityChanged" Loaded="InputGrid_Loaded" LoadingRow="ultraGridInput_LoadingRow">
            <DataGrid.Columns>
              <DataGridTemplateColumn CanUserResize="False" CellTemplate="{StaticResource RowDetailVisibilityToggleButton}" />
              <StaticResourceExtension ResourceKey="dataGridParameterName" xmlns="" />
              <DataGridTemplateColumn Header="Value" Width="90">
                <DataGridTemplateColumn.CellTemplateSelector>
                  <local:InputParameterValueDataTemplateSelector InputArrayEditCellDataTemplate="{StaticResource InputParameterArrayCellEditTemplate}" InputParameterDataTableEditCellDataTemplate="{StaticResource InputParameterDataTableCellEditTemplate}" DefaultCellEditTemplate="{StaticResource DefaultValueEditCellTemplate}" InputParameterFileNameEditCellDataTemplate="{StaticResource FileValueEditCellTemplate}" MultilineStringEditCellDataTemplate="{StaticResource MultilineEditCellTemplate}" ErrorValidationTemplate="{StaticResource ValidationErrorTemplate}" />
                </DataGridTemplateColumn.CellTemplateSelector>
              </DataGridTemplateColumn>
              <StaticResourceExtension ResourceKey="dataGridParameterUnit" />
              <DataGridTemplateColumn Header="Description" Width="57" CellTemplate="{StaticResource MultiLineDescriptionEditorTemplate}" />
              <StaticResourceExtension ResourceKey="dataGridParameterDataLogging" />
              <DataGridTemplateColumn Header="GV Set" CellTemplate="{StaticResource GVSetEditCellTemplate}" />
              <DataGridTemplateColumn Header="GV Get" CellTemplate="{StaticResource GVGetEditCellTemplate}" />
            </DataGrid.Columns>
          </DataGrid>
        </ScrollViewer>
      </DataTemplate>
      <DataTemplate x:Key="OutputGrid">
        <ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
          <DataGrid Name="OutputTemplateGrid" CanUserSortColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" SelectionMode="Extended" SelectionUnit="Cell" CanUserReorderColumns="False" AutoGenerateColumns="False" RowDetailsVisibilityMode="Collapsed" GotFocus="OutputDataGrid_GotFocus" RowDetailsVisibilityChanged="OutputGrid_RowDetailsVisibilityChanged" Loaded="OutputGrid_Loaded" LoadingRow="ultraGridOutput_LoadingRow">
            <DataGrid.Columns>
              <DataGridTemplateColumn CanUserResize="False" CellTemplate="{StaticResource RowDetailVisibilityToggleButton}" />
              <StaticResourceExtension ResourceKey="dataGridParameterName" />
              <StaticResourceExtension ResourceKey="dataGridParameterLL" />
              <DataGridTemplateColumn Header="Value" Width="90">
                <DataGridTemplateColumn.CellTemplateSelector>
                  <local:OutputParameterValueDataTemplateSelector OutputArrayEditCellDataTemplate="{StaticResource OutputParameterArrayCellEditTemplate}" OutputParameterDataTableEditCellDataTemplate="{StaticResource OutputParameterDataTableCellEditTemplate}" DefaultCellEditTemplate="{StaticResource DefaultOutputValueEditCellTemplate}" />
                </DataGridTemplateColumn.CellTemplateSelector>
              </DataGridTemplateColumn>
              <StaticResourceExtension ResourceKey="dataGridParameterUL" />
              <StaticResourceExtension ResourceKey="dataGridParameterUnit" />
              <DataGridTemplateColumn Header="Description" Width="57" CellTemplate="{StaticResource MultiLineDescriptionEditorTemplate}" />
              <StaticResourceExtension ResourceKey="dataGridParameterDataLogging" />
              <DataGridTemplateColumn Header="Logging Condition" CellTemplate="{StaticResource DataLoggingConditionEditCellTemplate}" />
              <DataGridTemplateColumn Header="GV Set" CellTemplate="{StaticResource GVSetEditCellTemplate}" />
              <DataGridTemplateColumn Header="GV Get" CellTemplate="{StaticResource GVGetEditCellTemplate}" />
              <DataGridTemplateColumn Header="GV LL Get" CellTemplate="{StaticResource GVGet_LL_EditCellTemplate}" />
              <DataGridTemplateColumn Header="GV UL Get" CellTemplate="{StaticResource GVGet_UL_EditCellTemplate}" />
            </DataGrid.Columns>
          </DataGrid>
        </ScrollViewer>
      </DataTemplate>
    </ResourceDictionary>
  </FrameworkElement.Resources>
  <Grid>
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto" />
      <RowDefinition Height="*" />
      <RowDefinition Height="Auto" />
      <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>
    <ToolBar Grid.Row="0" Margin="3" ToolBarTray.IsLocked="True" Loaded="paramToolbar_Loaded">
      <Button CommandParameter="ShowAllParams" ToolBar.OverflowMode="Never" Tag="ShowAllParams" ToolTip="Show unique parameters for all tests" Command="{Binding KeyCommand}" Visibility="{Binding Path=IsFolder, Converter={StaticResource boolToVisibilityConverter}}">
        <Image Source="/QSPR;component/Icons/ShowAllParams.png" Width="16" Height="16" />
      </Button>
      <TextBlock ToolBar.OverflowMode="Never" FontWeight="Bold" Margin="3" Visibility="{Binding Path=IsFolder, Converter={StaticResource boolToVisibilityConverter}}">Note:- Changes will be applied to all sub-nodes</TextBlock>
    </ToolBar>
    <Grid Row="1">
      <Grid.RowDefinitions>
        <RowDefinition Height="*" />
        <RowDefinition Height="3" />
        <RowDefinition Height="Auto" />
        <RowDefinition Height="3" />
      </Grid.RowDefinitions>
      <HeaderedContentControl Name="ultraGridInput" Grid.Row="0" Visibility="{Binding Path=ShowParameters, Converter={StaticResource boolToVisibilityConverter}, Mode=OneWay}">
        <HeaderedContentControl.Header>
          <Grid Background="{DynamicResource GridHeader}">
            <TextBlock Text="Input Parameters" Margin="3" HorizontalAlignment="Center" VerticalAlignment="Center" />
          </Grid>
        </HeaderedContentControl.Header>
      </HeaderedContentControl>
      <GridSplitter Grid.Row="1" Height="3" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" ShowsPreview="True" Visibility="{Binding Path=ShowParameters, Converter={StaticResource boolToVisibilityConverter}, Mode=OneWay}" />
      <HeaderedContentControl Name="ultraGridOutput" Grid.Row="2" Visibility="{Binding Path=ShowParameters, Converter={StaticResource boolToVisibilityConverter}, Mode=OneWay}">
        <HeaderedContentControl.Header>
          <Grid Background="{DynamicResource GridHeader}">
            <TextBlock Text="Output Parameters" HorizontalAlignment="Center" VerticalAlignment="Center" />
          </Grid>
        </HeaderedContentControl.Header>
      </HeaderedContentControl>
    </Grid>
    <GridSplitter Grid.Row="2" Height="3" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" ShowsPreview="True" Visibility="{Binding Path=ShowParameters, Converter={StaticResource boolToVisibilityConverter}, Mode=OneWay}" />
    <ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Auto">
      <Grid Visibility="{Binding Path=ShowParameters, Converter={StaticResource boolToVisibilityConverter}, Mode=OneWay}">
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto" />
          <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <TextBlock Name="textBoxParamName" Grid.Row="0" Text="ParameterName" FontWeight="Bold" Margin="3" />
        <TextBlock Name="textBoxParamDescrip" Grid.Row="1" Text="multi\r\nline\r\nparam\r\ndescription" TextWrapping="Wrap" Margin="3" />
      </Grid>
    </ScrollViewer>
  </Grid>
</UserControl>