<Window x:Class="VirtualCanvasTestCode.MainWindow"
          xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
          xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
          xmlns:h="http://helix-toolkit.org/wpf"
          xmlns:Local="clr-namespace:VirtualCanvasTestCode"
          xmlns:Behaviors="clr-namespace:Earthblend.Tts.Common.Core.Behaviors"
          mc:Ignorable="d" Background="Transparent" WindowState="Maximized"
          xmlns:Converters="clr-namespace:Earthblend.Tts.Common.Core.Converters"
          xmlns:themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
          xmlns:primitives="clr-namespace:System.Windows.Controls.Primitives;assembly=PresentationFramework"
          xmlns:Markups="clr-namespace:Earthblend.Tts.Common.Core.Markups"
          Title = "Scientific Research Suite-3D &amp; Formula output-Interaction Environment" 
          Height = "450" Width = "800" 
          x:Name="WC"
        >
    <!--
         WindowStyle="None"
    -->
    <Window.InputBindings>
        <KeyBinding Key="F1" Command="{Binding Path=RangeVm.GridXCommandIc,ElementName=WC}"/>
        <KeyBinding Key="F2" Command="{Binding Path=RangeVm.GridYCommandIc,ElementName=WC}"/>
        <KeyBinding Key="F3" Command="{Binding Path=RangeVm.GridZCommandIc,ElementName=WC}"/>

        <KeyBinding Key="F4" Command="{Binding Path=RangeVm.StartSpinXCommandIc,ElementName=WC}"/>
        <KeyBinding Key="F5" Command="{Binding Path=RangeVm.StartSpinYCommandIc,ElementName=WC}"/>
        <KeyBinding Key="F6" Command="{Binding Path=RangeVm.StartSpinZCommandIc,ElementName=WC}"/>

        <KeyBinding Key="F7" Command="{Binding Path=RangeVm.StopSpinXCommandIc,ElementName=WC}"/>
        <KeyBinding Key="F8" Command="{Binding Path=RangeVm.StopSpinYCommandIc,ElementName=WC}"/>
        <KeyBinding Key="F9" Command="{Binding Path=RangeVm.StopSpinZCommandIc,ElementName=WC}"/>
        <KeyBinding Key="Esc" Command="{Binding Path=RangeVm.ToggleFullScreenCommandIc,ElementName=WC}"/>
        <KeyBinding Key="F11" Command="{Binding Path=RangeVm.ToggleRenderTextCommandIc,ElementName=WC}"/>
        <KeyBinding Modifiers="Ctrl" Key="Q" Command="{Binding Path=RangeVm.ExitCommandIcCommandIc,ElementName=WC}"/>
    </Window.InputBindings>
    <Window.Resources>
        <ImageBrush x:Key="BlackTexture" ImageSource="{Markups:EnvironmentVar Image - 91061ed1-a220-4b07-8a6e-fe915d9b4d02.png}"/>
        <SolidColorBrush x:Key="AlternateBackgroundBrush">LightGray</SolidColorBrush>
        <!--<SolidColorBrush x:Key="NormalBorderBrush">DarkCyan</SolidColorBrush>-->
        <!--<SolidColorBrush x:Key="NormalBrush">Yellow</SolidColorBrush>-->
        <SolidColorBrush x:Key="BorderBrush">Black</SolidColorBrush>
        <SolidColorBrush x:Key="ControlContentBrush">Ivory</SolidColorBrush>
        <SolidColorBrush x:Key="MouseOverBrush">Seagreen</SolidColorBrush>
        <SolidColorBrush x:Key="TextBrush" Color="#FFFFFFFF" />
        <Color x:Key="TextColor">#FFFFFFFF</Color>
        <SolidColorBrush x:Key="NormalBrush" Color="#FF595959" />
        <SolidColorBrush x:Key="NormalBorderBrush" Color="#FF333333" />
        <SolidColorBrush x:Key="HoverBrush" Color="#FF393939" />
        <SolidColorBrush x:Key="GlyphBrush" Color="#FFD1D1D1" />

        <LinearGradientBrush x:Key="PressedBrush" EndPoint="0.5,0.971" StartPoint="0.5,0.042">
            <GradientStop Color="#4C000000" Offset="0" />
            <GradientStop Color="#26FFFFFF" Offset="1" />
            <GradientStop Color="#4C000000" Offset="0.467" />
            <GradientStop Color="#26FFFFFF" Offset="0.479" />
        </LinearGradientBrush>


        <SolidColorBrush x:Key="ControlBackgroundBrush" Color="#FF333333" />

        <LinearGradientBrush x:Key="SelectedBackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="#FFFFFFFF"/>
            <GradientStop Color="#FF737373" Offset="1"/>
        </LinearGradientBrush>

        <SolidColorBrush x:Key="DisabledForegroundBrush" Color="#888" />
        <SolidColorBrush x:Key="DisabledBackgroundBrush" Color="#FF787878" />
        <SolidColorBrush x:Key="DisabledBorderBrush" Color="#AAA" />
        <SolidColorBrush x:Key="WindowBackgroundBrush" Color="#FF595959" />

        <!-- EXPRESSION COMMON VALUES -->

        <LinearGradientBrush x:Key="ShineBrush" EndPoint="0.5,0.971" StartPoint="0.5,0.042">
            <GradientStop Color="#59FFFFFF" Offset="0" />
            <GradientStop Color="#00FFFFFF" Offset="1" />
            <GradientStop Color="#26FFFFFF" Offset="0.467" />
            <GradientStop Color="#00FFFFFF" Offset="0.475" />
        </LinearGradientBrush>

        <LinearGradientBrush x:Key="HoverShineBrush" EndPoint="0.5,0.971" StartPoint="0.5,0.042">
            <GradientStop Color="#4CFFFFFF" Offset="0" />
            <GradientStop Color="#26FFFFFF" Offset="1" />
            <GradientStop Color="#26FFFFFF" Offset="0.467" />
            <GradientStop Color="#00FFFFFF" Offset="0.475" />
            <GradientStop Color="#00FFFFFF" Offset="0.856" />
        </LinearGradientBrush>

        <LinearGradientBrush x:Key="PressedBorderBrush" EndPoint="0,1" StartPoint="0,0">
            <GradientStop Color="#444" Offset="0.0" />
            <GradientStop Color="#888" Offset="1.0" />
        </LinearGradientBrush>
        <Behaviors:FreezableBindingProxy x:Key="AlternateDataContext" Data="{Binding}"/>
        <SolidColorBrush x:Key="BackgroundBrush">Black</SolidColorBrush>
        <Style x:Key="BorderlessButtonStyle" TargetType="Button">
            <Setter Property="Background" Value="{StaticResource BackgroundBrush}"/>
            <Setter Property="OverridesDefaultStyle" Value="True" />
            <Setter Property="Foreground" Value="White" />
            <Setter Property="Cursor" Value="Hand" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Button">
                        <Border Name="border" BorderThickness="0" BorderBrush="Black" Background="{TemplateBinding Background}">
                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Opacity" Value="0.8" />
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <!--DataGridColumnHeader-->
        <Style x:Key="ColumnHeaderGripperStyle" TargetType="{x:Type Thumb}">
            <Setter Property="Width" Value="8"/>
            <Setter Property="Background" Value="Transparent"/>
            <Setter Property="Cursor" Value="SizeWE"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Thumb}">
                        <Border Padding="{TemplateBinding Padding}"
                    Background="{TemplateBinding Background}"/>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key='ColumnHeaderStyle' TargetType='{x:Type primitives:DataGridColumnHeader}'>
            <Setter Property="Foreground" Value="#FFFFFFFF" />
            <Setter Property="HorizontalContentAlignment" Value="Left" />
            <Setter Property="VerticalContentAlignment" Value="Center" />
            <Setter Property="FontSize" Value="10.5" />
            <Setter Property="FontWeight" Value="Bold" />
            <Setter Property="IsTabStop" Value="False" />
            <Setter Property="SeparatorBrush" Value="#FFC9CACA" />
            <!--<Setter Property="Padding" Value="4,4,5,4" />-->
            <Setter Property="Padding" Value="4,6,5,6"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type primitives:DataGridColumnHeader}">
                        <Grid>
                            <themes:DataGridHeaderBorder x:Name='HeaderBorder' 
                                                  SortDirection="{TemplateBinding SortDirection}"
                                                  IsHovered="{TemplateBinding IsMouseOver}"
                                                  IsPressed="{TemplateBinding IsPressed}"
                                                  IsClickable="{TemplateBinding CanUserSort}"
                                                  BorderThickness="0,0,1,1"
                                                  Background="{StaticResource NormalBrush}"
                                                  SeparatorVisibility="{TemplateBinding SeparatorVisibility}"
                                                  SeparatorBrush="#FFC9CACA">
                                <Grid Background='Transparent' >
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width='Auto' />
                                        <ColumnDefinition Width='*' />
                                    </Grid.ColumnDefinitions>
                                    <Rectangle x:Name="BackgroundRectangle" Grid.ColumnSpan="2" Grid.RowSpan="2" 
                                   Fill="{StaticResource NormalBrush}" Stretch="Fill" Stroke="{StaticResource NormalBorderBrush}" StrokeThickness="1" />
                                    <Rectangle x:Name="HoverRectangle" Grid.ColumnSpan="2" Grid.RowSpan="2" Stretch="Fill" 
                                   Fill="{StaticResource HoverBrush}" Opacity="0" />
                                    <ContentPresenter Grid.Column='0' 
                                                  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                  Margin='{TemplateBinding Padding}'
                                                  Cursor="{TemplateBinding Cursor}"
                                                  />
                                    <Rectangle x:Name="ShineRectangle" Fill="{StaticResource ShineBrush}" Stretch="Fill" 
                                   Stroke="{StaticResource NormalBorderBrush}" StrokeThickness="1" Grid.ColumnSpan="2" Grid.RowSpan="2" />
                                    <!--<Rectangle x:Name="VerticalSeparator" VerticalAlignment="Stretch" Width="1" Visibility="{TemplateBinding SeparatorVisibility}" 
                                   Grid.Column="2" Grid.RowSpan="2" Fill="{TemplateBinding SeparatorBrush}" />-->
                                    <Path HorizontalAlignment="Left" x:Name="SortArrow" VerticalAlignment="Center" 
                                      Width="8" Opacity="0" RenderTransformOrigin=".5,.5" Grid.Column="1" Grid.RowSpan="2" Fill="#FFFFFFFF" Stretch="Uniform" Data="F1 M -5.215,6.099L 5.215,6.099L 0,0L -5.215,6.099 Z ">
                                        <!--<Path.RenderTransform>
                                            <TransformGroup>
                                                <ScaleTransform ScaleX=".9" ScaleY=".9" x:Name="SortIconTransform" />
                                            </TransformGroup>
                                        </Path.RenderTransform>-->
                                    </Path>
                                </Grid>
                            </themes:DataGridHeaderBorder>
                            <Thumb x:Name="PART_LeftHeaderGripper"
                   HorizontalAlignment="Left"
                   Style="{StaticResource ColumnHeaderGripperStyle}"/>
                            <Thumb x:Name="PART_RightHeaderGripper"
                   HorizontalAlignment="Right"
                   Style="{StaticResource ColumnHeaderGripperStyle}"/>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="SortDirection" Value="Ascending">
                                <Setter TargetName="SortArrow" Property="Opacity" Value="1" />
                                <Setter TargetName="SortArrow" Property="RenderTransform">
                                    <Setter.Value>
                                        <RotateTransform Angle="180" />
                                    </Setter.Value>
                                </Setter>
                                <Setter TargetName="ShineRectangle" Property="Opacity" Value="1" />
                            </Trigger>
                            <Trigger Property="SortDirection" Value="Descending">
                                <Setter TargetName="SortArrow" Property="Opacity" Value="1" />
                                <Setter TargetName="ShineRectangle" Property="Opacity" Value="1" />
                            </Trigger>
                            <Trigger Property='IsMouseOver' Value='True'>
                                <Trigger.EnterActions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <DoubleAnimation BeginTime="00:00:00" 
                                                         Duration="00:00:00.20000"
                                                         Storyboard.TargetName="HoverRectangle" 
                                                         Storyboard.TargetProperty="(UIElement.Opacity)" 
                                                         To='1.0'                                                         
                                                         />
                                        </Storyboard>
                                    </BeginStoryboard>
                                </Trigger.EnterActions>
                                <Trigger.ExitActions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <DoubleAnimation BeginTime="00:00:00" 
                                                         Duration="00:00:00.20000"
                                                         Storyboard.TargetName="HoverRectangle" 
                                                         Storyboard.TargetProperty="(UIElement.Opacity)" 
                                                         To='0'                                                         
                                                         />
                                        </Storyboard>
                                    </BeginStoryboard>
                                </Trigger.ExitActions>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>


        </Style>
        <Style TargetType="{x:Type DataGridRow}">
            <Setter Property="SnapsToDevicePixels" Value="true"/>
            <Setter Property="Validation.ErrorTemplate" Value="{x:Null}"/>
            <Setter Property="ValidationErrorTemplate">
                <Setter.Value>
                    <ControlTemplate>
                        <Grid>
                            <Ellipse Width="12" Height="12" Margin="0 2 0 0" Fill="Red" Stroke="Black" VerticalAlignment="Top" StrokeThickness="0.5"/>
                            <TextBlock FontWeight="Bold" Padding="4,0,0,0" VerticalAlignment="Top" Foreground="White" Text="!" ToolTip="{Binding (Validation.Errors)[0].ErrorContent, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type DataGridRow}}}"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type DataGridRow}">
                        <ControlTemplate.Resources>
                            <Storyboard x:Key="SelectedOn">
                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="select_gradient" Storyboard.TargetProperty="(UIElement.Opacity)">
                                    <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1"/>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                            <Storyboard x:Key="SelectedOff">
                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="select_gradient" Storyboard.TargetProperty="(UIElement.Opacity)">
                                    <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                            <Storyboard x:Key="HoverOn">
                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="hover_gradient" Storyboard.TargetProperty="(UIElement.Opacity)">
                                    <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="0.85"/>
                                </DoubleAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="highlight" Storyboard.TargetProperty="(UIElement.Opacity)">
                                    <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="0.65"/>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                            <Storyboard x:Key="HoverOff">
                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="hover_gradient" Storyboard.TargetProperty="(UIElement.Opacity)">
                                    <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/>
                                </DoubleAnimationUsingKeyFrames>
                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="highlight" Storyboard.TargetProperty="(UIElement.Opacity)">
                                    <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                        </ControlTemplate.Resources>
                        <Border x:Name="DGR_Border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                            <SelectiveScrollingGrid>
                                <SelectiveScrollingGrid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="*"/>
                                </SelectiveScrollingGrid.ColumnDefinitions>
                                <SelectiveScrollingGrid.RowDefinitions>
                                    <RowDefinition Height="*"/>
                                    <RowDefinition Height="Auto"/>
                                </SelectiveScrollingGrid.RowDefinitions>
                                <Rectangle x:Name="hover_gradient" Stroke="{DynamicResource FocusBrush}" StrokeThickness="1" RadiusX="1" RadiusY="1" Opacity="0" IsHitTestVisible="False" Grid.Column="1" Fill="{DynamicResource MouseOverBrush}"/>
                                <Rectangle x:Name="highlight" Margin="1" StrokeThickness="1" RadiusX="0.5" RadiusY="0.5" Opacity="0" IsHitTestVisible="False" Grid.Column="1" Stroke="{DynamicResource MouseOverHighlightBrush}" Fill="{DynamicResource MouseOverHighlightBrush}"/>
                                <Rectangle x:Name="select_gradient" Grid.Row="0" Grid.ColumnSpan="2" StrokeThickness="1" RadiusX="1" RadiusY="1" Opacity="0" IsHitTestVisible="False" Fill="{DynamicResource PressedBrush}" Stroke="{DynamicResource PressedBorderBrush}"/>
                                <DataGridCellsPresenter Grid.Column="1" ItemsPanel="{TemplateBinding ItemsPanel}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                                <DataGridDetailsPresenter Grid.Column="1" Grid.Row="1" SelectiveScrollingGrid.SelectiveScrollingOrientation="{Binding AreRowDetailsFrozen, ConverterParameter={x:Static SelectiveScrollingOrientation.Vertical}, Converter={x:Static DataGrid.RowDetailsScrollingConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}" Visibility="{TemplateBinding DetailsVisibility}"/>
                                <DataGridRowHeader Grid.RowSpan="2" SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Visibility="{Binding HeadersVisibility, ConverterParameter={x:Static DataGridHeadersVisibility.Row}, Converter={x:Static DataGrid.HeadersVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"/>
                            </SelectiveScrollingGrid>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True" SourceName="DGR_Border">
                                <Trigger.ExitActions>
                                    <BeginStoryboard Storyboard="{StaticResource HoverOff}" x:Name="HoverOff_BeginStoryboard"/>
                                </Trigger.ExitActions>
                                <Trigger.EnterActions>
                                    <BeginStoryboard Storyboard="{StaticResource HoverOn}" x:Name="HoverOn_BeginStoryboard"/>
                                </Trigger.EnterActions>
                            </Trigger>
                            <Trigger Property="IsSelected" Value="true">
                                <Trigger.ExitActions>
                                    <BeginStoryboard x:Name="SelectedOff_BeginStoryboard" Storyboard="{StaticResource SelectedOff}"/>
                                </Trigger.ExitActions>
                                <Trigger.EnterActions>
                                    <BeginStoryboard Storyboard="{StaticResource SelectedOn}"/>
                                </Trigger.EnterActions>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style TargetType="{x:Type DataGridCell}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type DataGridCell}">
                        <ControlTemplate.Resources>
                            <Storyboard x:Key="SelectedOn">
                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="select_gradient" Storyboard.TargetProperty="(UIElement.Opacity)">
                                    <SplineDoubleKeyFrame KeyTime="00:00:00.1000000" Value="1"/>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                            <Storyboard x:Key="SelectedOff">
                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="select_gradient" Storyboard.TargetProperty="(UIElement.Opacity)">
                                    <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                        </ControlTemplate.Resources>
                        <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="True">
                            <Grid>
                                <Rectangle x:Name="select_gradient" Margin="-2 -1 -2 -1" Grid.Column="1" StrokeThickness="1" RadiusX="1" RadiusY="1" Opacity="0" IsHitTestVisible="False" Fill="{DynamicResource PressedBrush}" Stroke="{DynamicResource PressedBorderBrush}"/>
                                <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                            </Grid>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected" Value="true">
                                <Trigger.ExitActions>
                                    <BeginStoryboard x:Name="SelectedOff_BeginStoryboard" Storyboard="{StaticResource SelectedOff}"/>
                                </Trigger.ExitActions>
                                <Trigger.EnterActions>
                                    <BeginStoryboard Storyboard="{StaticResource SelectedOn}"/>
                                </Trigger.EnterActions>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style TargetType="{x:Type DataGridColumnHeader}">
            <Setter Property="Background" Value="{DynamicResource NormalBorderBrush}"/>
            <Setter Property="Foreground" Value="{DynamicResource TextBrush}"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="Height" Value="30"/>
            <Setter Property="SeparatorBrush" Value="#FFC9CACA"/>
            <Setter Property="FontSize" Value="14"/>
            <Setter Property="FontWeight" Value="SemiBold"/>
            <Setter Property="Padding" Value="4 0 0 0"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type DataGridColumnHeader}">
                        <ControlTemplate.Resources>
                            <Storyboard x:Key="HoverOn">
                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Hover" Storyboard.TargetProperty="(UIElement.Opacity)">
                                    <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1"/>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                            <Storyboard x:Key="HoverOff">
                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Hover" Storyboard.TargetProperty="(UIElement.Opacity)">
                                    <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                        </ControlTemplate.Resources>
                        <Grid Background='Transparent'>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width='Auto'/>
                                <ColumnDefinition Width='Auto'/>
                                <ColumnDefinition Width='*'/>
                                <ColumnDefinition Width='Auto'/>
                            </Grid.ColumnDefinitions>
                            <Rectangle x:Name="BackgroundRectangle" Grid.ColumnSpan="4" Grid.RowSpan="2" Fill="{StaticResource NormalBrush}" Stretch="Fill" Stroke="{StaticResource NormalBorderBrush}" StrokeThickness="1"/>
                            <Rectangle x:Name="Hover" Grid.ColumnSpan="4" Grid.RowSpan="2" Stretch="Fill" Fill="{StaticResource MouseOverBrush}" Opacity="0"/>
                            <ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin='{TemplateBinding Padding}' Cursor="{TemplateBinding Cursor}"/>
                            <Path HorizontalAlignment="Left" x:Name="SortArrow" VerticalAlignment="Center" Width="8" Opacity="0" RenderTransformOrigin=".5,.5" Grid.Column="2" Grid.RowSpan="2" Fill="#FF000000" Stretch="Uniform" Data="F1 M -5.215,6.099L 5.215,6.099L 0,0L -5.215,6.099 Z ">
                                <!--<Path.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform ScaleX=".9" ScaleY=".9" x:Name="SortIconTransform"/>
                                    </TransformGroup>
                                </Path.RenderTransform>-->
                            </Path>
                            <Thumb x:Name="PART_LeftHeaderGripper" Grid.Column="0" HorizontalAlignment="Left" Style="{StaticResource ColumnHeaderGripperStyle}"/>
                            <Thumb x:Name="PART_RightHeaderGripper" Grid.Column="3" HorizontalAlignment="Right" Style="{StaticResource ColumnHeaderGripperStyle}"/>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="SortDirection" Value="Ascending">
                                <Setter TargetName="SortArrow" Property="Opacity" Value="1"/>
                                <Setter TargetName="SortArrow" Property="RenderTransform">
                                    <Setter.Value>
                                        <RotateTransform Angle="180"/>
                                    </Setter.Value>
                                </Setter>
                                <Setter TargetName="BackgroundRectangle" Property="Opacity" Value="1"/>
                            </Trigger>
                            <Trigger Property="SortDirection" Value="Descending">
                                <Setter TargetName="SortArrow" Property="Opacity" Value="1"/>
                                <Setter TargetName="BackgroundRectangle" Property="Opacity" Value="1"/>
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="true">
                                <Trigger.EnterActions>
                                    <BeginStoryboard Storyboard="{StaticResource HoverOn}"/>
                                </Trigger.EnterActions>
                                <Trigger.ExitActions>
                                    <BeginStoryboard Storyboard="{StaticResource HoverOff}"/>
                                </Trigger.ExitActions>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <!--Style and template for the DataGridColumnHeadersPresenter.-->
        <Style TargetType="{x:Type DataGridColumnHeadersPresenter}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type DataGridColumnHeadersPresenter}">
                        <Grid>
                            <DataGridColumnHeader x:Name="PART_FillerColumnHeader" IsHitTestVisible="False"/>
                            <ItemsPresenter />
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="{ComponentResourceKey ResourceId=DataGridSelectAllButtonStyle, TypeInTargetAssembly={x:Type DataGrid}}" TargetType="{x:Type Button}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Grid>
                            <Rectangle x:Name="Border" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" SnapsToDevicePixels="True"/>
                            <Polygon x:Name="Arrow" Fill="Black" HorizontalAlignment="Right" Margin="8,8,3,3" Opacity="0.15" Points="0,10 10,10 10,0" Stretch="Uniform" VerticalAlignment="Bottom"/>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="Stroke" TargetName="Border" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/>
                            </Trigger>
                            <Trigger Property="IsPressed" Value="True">
                                <Setter Property="Fill" TargetName="Border" Value="{DynamicResource {x:Static SystemColors.ControlDarkBrushKey}}"/>
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter Property="Visibility" TargetName="Arrow" Value="Collapsed"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </Window.Resources>
    <!--To Restore: Changed Background to Black-->
    <Grid Background="#333333">
        <Grid.Resources>

            <Behaviors:FreezableBindingProxy x:Key="MainViewModelDataContext" Data="{Binding}"/>
            <BooleanToVisibilityConverter x:Key="bool2VisibilityConverter" />
            <Converters:GreaterThanConverter x:Key="GreaterThanConverter"/>
            <SolidColorBrush x:Key="RepeatButtonColor" Color="Black"/>
            <SolidColorBrush x:Key="RepeatButtonForeground" Color="White"/>

            <SolidColorBrush x:Key="FlippedBlackBackgroundBrush" Color="Silver"/>

            <ImageBrush x:Key="BlackBackgroundBrush" ImageSource="{Markups:EnvironmentVar BlackGradient.png}"/>
            <ImageBrush x:Key="BlueTitleBrush" ImageSource="{Markups:EnvironmentVar BlackGradient.png}"/>

            <Thickness x:Key="TitleMargin">20,-26,0,0</Thickness>
            <Style x:Key="BorderlessButtonStyle" TargetType="Button">
                <Setter Property="Background" Value="{StaticResource BackgroundBrush}"/>
                <Setter Property="OverridesDefaultStyle" Value="True" />
                <Setter Property="Foreground" Value="White" />
                <Setter Property="Cursor" Value="Hand" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="Button">
                            <Border Name="border" BorderThickness="0" BorderBrush="Black" Background="{TemplateBinding Background}">
                                <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Opacity" Value="0.8" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
            <Style x:Key="AreaBorderStyle" TargetType="{x:Type Border}">
                <Setter Property="BorderBrush" Value="{StaticResource BlackBackgroundBrush}"/>
                <Setter Property="Margin" Value="10"/>
                <Setter Property="CornerRadius" Value="15"/>
                <Setter Property="BorderThickness" Value="3,0,3,3"/>
            </Style>

            <Style x:Key="TitleAreaBorderStyle" TargetType="{x:Type Border}" BasedOn="{StaticResource AreaBorderStyle}">
                <Setter Property="BorderBrush" Value="{StaticResource BlueTitleBrush}"/>
                <Setter Property="BorderThickness" Value="0,30,0,0"/>
            </Style>

            <Color x:Key="TabItemGradStart" R="#AA" G="#AA" B="#BB"/>
            <Color x:Key="TabItemGradEnd" R="#EE" G="#EE" B="#FF" A="#FF"/>
            <Color x:Key="TabItemGradStartSel" R="#00" G="#00" B="#DD"/>
            <Color x:Key="TabItemGradEndSel" R="#99" G="#99" B="#FF" A="#FF"/>
            <Color x:Key="TabItemGradStartDisabled" R="#AA" G="#AA" B="#AA"/>
            <Color x:Key="TabItemGradEndDisabled" R="#FF" G="#FF" B="#FF" A="#FF"/>
            <Color x:Key="TabItemGradStartHover" R="#FF" G="#FF" B="#66"/>
            <Color x:Key="TabItemGradEndHover" R="#FF" G="#FF" B="#99" A="#FF"/>

            <Color x:Key="SelectedBackgroundColor">Transparent</Color>
            <Color x:Key="MainColor">Transparent</Color>
            <!--Not Used-->
            <Color x:Key="SelectedColor">#333333</Color>
            <Color x:Key="HoverColor">Gray</Color>
            <!--Not Important #333333 -->
            <Color x:Key="HeaderColor">#333333</Color>
            <!-- #36454f -->
            <Color x:Key="BodyColor">Transparent</Color>
            <!--Not Used-->
            <!-- #36454f -->

            <SolidColorBrush x:Key="MainColorBrush" Color="{StaticResource MainColor}"/>
            <SolidColorBrush x:Key="HeaderColorBrush" Color="{StaticResource HeaderColor}"/>
            <SolidColorBrush x:Key="BodyColorBrush" Color="{StaticResource BodyColor}"/>

            <LinearGradientBrush x:Key="TabBackgroundBrushSel" StartPoint="0,0" EndPoint="0,1" >
                <GradientStop Offset="0" Color="{StaticResource SelectedColor}"/>
                <GradientStop Offset="1" Color="{StaticResource SelectedColor}"/>
            </LinearGradientBrush>

            <LinearGradientBrush x:Key="TabBackgroundBrush" EndPoint="0.504,1.5" StartPoint="0.504,0.03">
                <GradientStop Color="#FFFFC934" Offset="0"/>
                <GradientStop Color="#FFFFFFFF" Offset="0.567"/>
            </LinearGradientBrush>

            <!--<LinearGradientBrush x:Key="TabBackgroundBrushSel" StartPoint="0,0" EndPoint="0,1" >
            <GradientStop Offset="0" Color="{StaticResource SelectedBackgroundColor}"/>
            <GradientStop Offset="1" Color="{StaticResource SelectedBackgroundColor}"/>
        </LinearGradientBrush>-->
            <LinearGradientBrush x:Key="TabBackgroundBrushDisabled" StartPoint="0,0" EndPoint="0,1" >
                <GradientStop Offset="0" Color="{StaticResource HoverColor}"/>
                <GradientStop Offset="1" Color="{StaticResource HoverColor}"/>
            </LinearGradientBrush>
            <LinearGradientBrush x:Key="TabBackgroundBrushHover" StartPoint="0,0" EndPoint="0,1" >
                <GradientStop Offset="0" Color="{StaticResource MainColor}"/>
                <GradientStop Offset="1" Color="{StaticResource MainColor}"/>
            </LinearGradientBrush>

            <SolidColorBrush x:Key="CommandSystemFieldsBrush">Firebrick</SolidColorBrush>
            <SolidColorBrush x:Key="CommandSystemPluginFieldsText">White</SolidColorBrush>

            <SolidColorBrush x:Key="SystemFieldsBrush">#333333</SolidColorBrush>
            <SolidColorBrush x:Key="SystemPluginFieldsText">White</SolidColorBrush>

            <SolidColorBrush x:Key="LookupFieldsBrush">Black</SolidColorBrush>
            <SolidColorBrush x:Key="LookupPluginFieldsText">White</SolidColorBrush>

            <SolidColorBrush x:Key="DynamicPluginFieldsBrush">DarkBlue</SolidColorBrush>
            <SolidColorBrush x:Key="DynamicPluginFieldsText">White</SolidColorBrush>

            <SolidColorBrush x:Key="ImageFieldsBrush">Yellow</SolidColorBrush>
            <SolidColorBrush x:Key="ImageFieldsText">Black</SolidColorBrush>



            <Style TargetType="Button" x:Key="TabButton">
                <Setter Property="TextBlock.TextAlignment" Value="Center" />
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="Button">
                            <Border 
                            CornerRadius="{TemplateBinding Border.CornerRadius}" 
                            Background="{TemplateBinding Background}" 
                            BorderBrush="{TemplateBinding BorderBrush}" 
                            BorderThickness="{TemplateBinding BorderThickness}"
                            >

                                <ContentPresenter x:Name="contentPresenter" 
                                ContentTemplate="{TemplateBinding ContentTemplate}" 
                                Content="{TemplateBinding Content}" 
                                HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                Margin="{TemplateBinding Padding}" 
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                                </ContentPresenter>
                            </Border>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding Path=SymbolType}" Value="Model3D">
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="Button">
                                    <h:HelixViewport3D ZoomExtentsWhenLoaded="True">
                                        <ModelVisual3D>
                                            <ModelVisual3D.Content>
                                                <AmbientLight></AmbientLight>
                                            </ModelVisual3D.Content>
                                        </ModelVisual3D>
                                        <ModelVisual3D Content="{Binding Path=CanvasModel3DGroup}"/>
                                    </h:HelixViewport3D>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="ElementButtonBaseStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource TabButton}">
                <Setter Property="Border.CornerRadius" Value="3"/>
                <Setter Property="BorderBrush" Value="Transparent"/>
                <Setter Property="RenderTransform">
                    <Setter.Value>
                        <TranslateTransform X="{Binding Path=Left,Mode=OneWay}" Y="{Binding Path=Top,Mode=OneWay}"/>
                    </Setter.Value>
                </Setter>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding Path=SymbolType,Mode=OneWay}" Value="Answer">
                        <Setter Property="Background" Value="Black"/>
                        <Setter Property="Foreground" Value="Yellow"/>
                        <Setter Property="FontWeight" Value="Bold"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Path=SymbolType,Mode=OneWay}" Value="Number">
                        <Setter Property="Background" Value="ForestGreen"/>
                        <Setter Property="Foreground" Value="White"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Path=SymbolType,Mode=OneWay}" Value="Uom">
                        <Setter Property="Background" Value="Black"/>
                        <Setter Property="Foreground" Value="White"/>
                        <Setter Property="FontWeight" Value="Bold"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Path=SymbolType,Mode=OneWay}" Value="Caption">
                        <Setter Property="Background" Value="Yellow"/>
                        <Setter Property="Foreground" Value="Black"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Path=SymbolType,Mode=OneWay}" Value="Operator">
                        <Setter Property="Background" Value="DarkRed"/>
                        <Setter Property="Foreground" Value="White"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Path=SymbolType,Mode=OneWay}" Value="Equals">
                        <Setter Property="Background" Value="DarkCyan"/>
                        <Setter Property="Foreground" Value="White"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Path=SymbolType,Mode=OneWay}" Value="Space">
                        <Setter Property="Background" Value="Black"/>
                        <Setter Property="Foreground" Value="White"/>
                    </DataTrigger>

                    <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding Path=SymbolType,Mode=OneWay}" Value="EquationVariable"/>
                            <Condition Binding="{Binding Path=Statement,Mode=OneWay}" Value="Function"/>
                        </MultiDataTrigger.Conditions>
                        <MultiDataTrigger.Setters>
                            <Setter Property="Background" Value="DarkBlue"/>
                            <Setter Property="Foreground" Value="White"/>
                            <Setter Property="FontWeight" Value="Bold"/>
                        </MultiDataTrigger.Setters>
                    </MultiDataTrigger>

                    <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding Path=SymbolType,Mode=OneWay}" Value="EquationVariable"/>
                            <Condition Binding="{Binding Path=Statement,Mode=OneWay}" Value="AutoProperty"/>
                        </MultiDataTrigger.Conditions>
                        <MultiDataTrigger.Setters>
                            <Setter Property="Background" Value="Wheat"/>
                            <Setter Property="Foreground" Value="Black"/>
                            <Setter Property="FontWeight" Value="Bold"/>
                        </MultiDataTrigger.Setters>
                    </MultiDataTrigger>


                    <DataTrigger Binding="{Binding Path=SymbolType,Mode=OneWay}" Value="LeftParan">
                        <Setter Property="Background" Value="Yellow"/>
                        <Setter Property="Foreground" Value="Black"/>
                        <Setter Property="FontWeight" Value="Bold"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Path=SymbolType,Mode=OneWay}" Value="RightParan">
                        <Setter Property="Background" Value="Yellow"/>
                        <Setter Property="Foreground" Value="Black"/>
                        <Setter Property="FontWeight" Value="Bold"/>
                    </DataTrigger>

                    <DataTrigger Binding="{Binding Path=SymbolType,Mode=OneWay}" Value="LeftBrace">
                        <Setter Property="Background" Value="Lime"/>
                        <Setter Property="Foreground" Value="Black"/>
                        <Setter Property="FontWeight" Value="Bold"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Path=SymbolType,Mode=OneWay}" Value="RightBrace">
                        <Setter Property="Background" Value="Lime"/>
                        <Setter Property="Foreground" Value="Black"/>
                        <Setter Property="FontWeight" Value="Bold"/>
                    </DataTrigger>

                    <DataTrigger Binding="{Binding Path=SymbolType,Mode=OneWay}" Value="LeftBracket">
                        <Setter Property="Background" Value="Brown"/>
                        <Setter Property="Foreground" Value="White"/>
                        <Setter Property="FontWeight" Value="Bold"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Path=SymbolType,Mode=OneWay}" Value="RightBracket">
                        <Setter Property="Background" Value="Brown"/>
                        <Setter Property="Foreground" Value="White"/>
                        <Setter Property="FontWeight" Value="Bold"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Path=SymbolType,Mode=OneWay}" Value="RightParanPower">
                        <Setter Property="Background" Value="LightBlue"/>
                        <Setter Property="Foreground" Value="Black"/>
                        <Setter Property="FontWeight" Value="Bold"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Path=SymbolType,Mode=OneWay}" Value="LeftParanPower">
                        <Setter Property="Background" Value="LightBlue"/>
                        <Setter Property="Foreground" Value="Black"/>
                        <Setter Property="FontWeight" Value="Bold"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Path=SymbolType,Mode=OneWay}" Value="Literal">
                        <Setter Property="Background" Value="Orange"/>
                        <Setter Property="Foreground" Value="Black"/>
                        <Setter Property="FontWeight" Value="Bold"/>
                    </DataTrigger>

                    <DataTrigger Binding="{Binding Path=SymbolType,Mode=OneWay}" Value="Superscript">
                        <Setter Property="Background" Value="PeachPuff"/>
                        <Setter Property="Foreground" Value="Black"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Path=SymbolType,Mode=OneWay}" Value="Subscript">
                        <Setter Property="Background" Value="Orange"/>
                        <Setter Property="Foreground" Value="Black"/>
                    </DataTrigger>

                    <DataTrigger Binding="{Binding Path=SymbolType,Mode=OneWay}" Value="Variable">
                        <Setter Property="Background" Value="DarkSalmon"/>
                        <Setter Property="Foreground" Value="Black"/>
                    </DataTrigger>

                    <DataTrigger Binding="{Binding Path=SymbolType,Mode=OneWay}" Value="DynamicMesh">
                        <Setter Property="Background" Value="Black"/>
                        <Setter Property="Foreground" Value="Wheat"/>
                    </DataTrigger>

                    <DataTrigger Binding="{Binding Path=SymbolType}" Value="SquareRoot">
                        <Setter Property="Background" Value="Purple"/>
                        <Setter Property="Foreground" Value="White"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Path=SymbolType}" Value="Constant">
                        <Setter Property="Background" Value="Gold"/>
                        <Setter Property="Foreground" Value="Black"/>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Path=IsSelected}" Value="True">
                        <Setter Property="BorderBrush" Value="White"/>
                        <Setter Property="BorderThickness" Value="1"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="CanvasElementButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource ElementButtonBaseStyle}">
                <!--<Setter Property="FontSize" Value="8"/>-->
                <Style.Triggers>
                    <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding Path=Data.SelectionMode,Mode=OneWay,Source={StaticResource MainViewModelDataContext}}" Value="VirtualCanvas"/>
                        </MultiDataTrigger.Conditions>
                        <MultiDataTrigger.Setters>
                            <Setter Property="BorderBrush" Value="White"/>
                            <Setter Property="BorderThickness" Value="1"/>
                        </MultiDataTrigger.Setters>
                    </MultiDataTrigger>

                    <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding Path=Data.SelectionMode,Mode=OneWay,Source={StaticResource MainViewModelDataContext}}" Value="VirtualEquation"/>
                            <Condition Binding="{Binding Path=IsSelected,Mode=OneWay}" Value="True"/>
                        </MultiDataTrigger.Conditions>
                        <MultiDataTrigger.Setters>
                            <Setter Property="BorderBrush" Value="White"/>
                            <Setter Property="BorderThickness" Value="1"/>
                        </MultiDataTrigger.Setters>
                    </MultiDataTrigger>

                    <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding Path=Data.SelectionMode,Mode=OneWay,Source={StaticResource MainViewModelDataContext}}" Value="VirtualEquationElement"/>
                            <Condition Binding="{Binding Path=IsSelected,Mode=OneWay}" Value="True"/>
                        </MultiDataTrigger.Conditions>
                        <MultiDataTrigger.Setters>
                            <Setter Property="BorderBrush" Value="White"/>
                            <Setter Property="BorderThickness" Value="1"/>
                        </MultiDataTrigger.Setters>
                    </MultiDataTrigger>

                    <MultiDataTrigger>
                        <MultiDataTrigger.Conditions>
                            <Condition Binding="{Binding Path=Data.SelectionMode,Mode=OneWay,Source={StaticResource MainViewModelDataContext}}" Value="VirtualGroup"/>
                            <Condition Binding="{Binding Path=IsSelected,Mode=OneWay}" Value="True"/>
                        </MultiDataTrigger.Conditions>
                        <MultiDataTrigger.Setters>
                            <Setter Property="BorderBrush" Value="White"/>
                            <Setter Property="BorderThickness" Value="1"/>
                        </MultiDataTrigger.Setters>
                    </MultiDataTrigger>
                    <DataTrigger Binding="{Binding Path=IsEnabled,Mode=OneWay}" Value="False">
                        <Setter Property="Background" Value="DarkGray"/>
                        <Setter Property="Foreground" Value="White"/>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

            <Style x:Key="GelTabItem" TargetType="{x:Type TabItem}">
                <Setter Property="BorderThickness" Value="1"/>
                <Setter Property="BorderBrush" Value="Transparent"/>
                <Setter Property="Background" Value="Black"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>
                <Setter Property="HorizontalContentAlignment" Value="Center"/>
                <Setter Property="Foreground" Value="Transparent"/>
                <Setter Property="FontWeight" Value="Bold"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type TabItem}">
                            <Border Padding="3">
                                <Grid >
                                    <Border Background="{TemplateBinding Background}" 
                                        BorderBrush="{TemplateBinding BorderBrush}" 
                                        BorderThickness="{TemplateBinding BorderThickness}" />
                                    <Rectangle Name="TabItemBackground" RadiusX="5" RadiusY="5">
                                        <Rectangle.Style>
                                            <Style TargetType="{x:Type Rectangle}">
                                                <Setter Property="Fill" Value="{StaticResource TabBackgroundBrush}"/>
                                            </Style>
                                        </Rectangle.Style>
                                    </Rectangle>
                                    <Border BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
                                        <Grid>
                                            <ContentPresenter  ContentSource="Header" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                                                       VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                            <StackPanel Orientation="Horizontal">
                                                <TextBlock Name="txt" Text="{TemplateBinding Header}" />
                                                <!--<TextBlock Text=" - " Foreground="Red"/>
                                                <TextBlock Foreground="Red" Text="{Binding Path=Tag,RelativeSource={RelativeSource AncestorType={x:Type TabItem}},StringFormat='###,###'}"/>-->
                                            </StackPanel>
                                        </Grid>
                                    </Border>
                                </Grid>
                            </Border>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsSelected" Value="True">
                                    <Setter TargetName="TabItemBackground" Property="Fill" Value="{StaticResource TabBackgroundBrush}" />
                                    <Setter TargetName="txt" Property="Foreground" Value="Red" />

                                </Trigger>
                                <Trigger Property="IsSelected" Value="False">
                                    <Setter TargetName="TabItemBackground" Property="Fill" Value="{StaticResource TabBackgroundBrushSel}" />
                                    <Setter TargetName="txt" Property="Foreground" Value="Lime" />

                                </Trigger>
                                <Trigger Property="IsEnabled" Value="False">
                                    <Setter TargetName="TabItemBackground" Property="Fill" Value="{StaticResource TabBackgroundBrushDisabled}" />
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>

            <Style x:Key="GelTabControl" TargetType="{x:Type TabControl}">
                <Setter Property="Foreground" Value="White"/>
                <Style.Triggers>
                    <DataTrigger Binding="{Binding Path=TabStripPlacement,RelativeSource={RelativeSource Self}}" Value="Top">
                        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="TabControl">
                                    <Grid Background="Transparent">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="Auto"  />
                                            <RowDefinition />
                                        </Grid.RowDefinitions>
                                        <TabPanel Grid.Row="0" IsItemsHost="true">
                                            <TabPanel.Style>
                                                <Style TargetType="{x:Type TabPanel}">
                                                    <!--<Style.Triggers>
                                                    <DataTrigger Binding="{Binding Path=Items.Count,RelativeSource={RelativeSource AncestorType={x:Type TabControl}}}" Value="1">
                                                        <Setter Property="Visibility" Value="Collapsed"/>
                                                    </DataTrigger>
                                                </Style.Triggers>-->
                                                </Style>
                                            </TabPanel.Style>
                                        </TabPanel>
                                        <!--Tab Content-->
                                        <Grid Grid.Row="1">
                                            <Border >
                                                <Border.Style>
                                                    <Style TargetType="{x:Type Border}">
                                                        <Setter Property="BorderBrush" Value="Transparent"/>
                                                        <Setter Property="BorderThickness" Value="0"/>
                                                        <Setter Property="CornerRadius" Value="5,5,5,5"/>
                                                        <Setter Property="Background" Value="{StaticResource TabBackgroundBrushSel}"/>
                                                        <!--<Setter Property="Background" Value="{StaticResource HeaderColorBrush}"/>-->
                                                        <!--<Setter Property="Padding" Value="5,5,5,5"/>-->
                                                        <Style.Triggers>
                                                            <DataTrigger Binding="{Binding Path=Items.Count,RelativeSource={RelativeSource AncestorType={x:Type TabControl}}}" Value="1">
                                                                <Setter Property="CornerRadius" Value="0"/>
                                                            </DataTrigger>
                                                        </Style.Triggers>
                                                    </Style>
                                                </Border.Style>
                                                <ContentPresenter ContentSource="SelectedContent" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                                            </Border>
                                        </Grid>
                                    </Grid>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Path=TabStripPlacement,RelativeSource={RelativeSource Self}}" Value="Left">
                        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="TabControl">
                                    <Grid >
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="Auto" />
                                            <ColumnDefinition  />
                                        </Grid.ColumnDefinitions>
                                        <Grid Grid.Column="1" Background="Transparent" Margin="2">
                                            <Border >
                                                <Border.Style>
                                                    <Style TargetType="{x:Type Border}">
                                                        <Setter Property="BorderBrush" Value="Transparent"/>
                                                        <Setter Property="BorderThickness" Value="0"/>
                                                        <Setter Property="CornerRadius" Value="5,5,5,5"/>
                                                        <Setter Property="Background" Value="{StaticResource TabBackgroundBrushSel}"/>
                                                        <Setter Property="Padding" Value="5,5,5,5"/>
                                                        <Style.Triggers>
                                                            <DataTrigger Binding="{Binding Path=Items.Count,RelativeSource={RelativeSource AncestorType={x:Type TabControl}}}" Value="1">
                                                                <Setter Property="CornerRadius" Value="0"/>
                                                            </DataTrigger>
                                                        </Style.Triggers>
                                                    </Style>
                                                </Border.Style>
                                                <ContentPresenter ContentSource="SelectedContent" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                                            </Border>
                                        </Grid>
                                        <TabPanel Grid.Column="0" IsItemsHost="true"/>
                                    </Grid>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </DataTrigger>
                    <DataTrigger Binding="{Binding Path=TabStripPlacement,RelativeSource={RelativeSource Self}}" Value="Right">
                        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                        <Setter Property="VerticalContentAlignment" Value="Stretch"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="TabControl">
                                    <Grid >
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition />
                                            <ColumnDefinition Width="Auto" />
                                        </Grid.ColumnDefinitions>
                                        <Grid Grid.Column="0" Background="Transparent" Margin="2">
                                            <Border >
                                                <Border.Style>
                                                    <Style TargetType="{x:Type Border}">
                                                        <Setter Property="BorderBrush" Value="Transparent"/>
                                                        <Setter Property="BorderThickness" Value="0"/>
                                                        <Setter Property="CornerRadius" Value="5,5,5,5"/>
                                                        <Setter Property="Background" Value="{StaticResource TabBackgroundBrushSel}"/>
                                                        <Setter Property="Padding" Value="5,5,5,5"/>
                                                        <Style.Triggers>
                                                            <DataTrigger Binding="{Binding Path=Items.Count,RelativeSource={RelativeSource AncestorType={x:Type TabControl}}}" Value="1">
                                                                <Setter Property="CornerRadius" Value="0"/>
                                                            </DataTrigger>
                                                        </Style.Triggers>
                                                    </Style>
                                                </Border.Style>
                                                <ContentPresenter ContentSource="SelectedContent" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                                            </Border>
                                        </Grid>
                                        <TabPanel Grid.Column="1" IsItemsHost="true"/>
                                    </Grid>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                    </DataTrigger>
                </Style.Triggers>
            </Style>

        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition />
            <RowDefinition Height="0"/>
            <!--To Restore: Remove Height = 0-->
            <RowDefinition Height="0" >
                <RowDefinition.Style>
                    <Style TargetType="{x:Type RowDefinition}">
                        <Setter Property="Height" Value="0"/>
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding Path=RangeVm.FullScreen,ElementName=WC}" Value="False">
                                <Setter Property="Height" Value="500"/>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </RowDefinition.Style>
            </RowDefinition>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <!--To Restore: swap out single for commented-->
            <ColumnDefinition/>
            <!--<ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="50"/>
            <ColumnDefinition Width="50"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition/>-->
        </Grid.ColumnDefinitions>
        <!--To Restore: Changed Background to Black-->
        <Grid Grid.Row="0" Background="#333333" Grid.ColumnSpan="5">
            <Grid.Style>
                <Style TargetType="{x:Type Grid}">
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Path=RangeVm.FullScreen,ElementName=WC}" Value="True">
                            <Setter Property="Visibility" Value="Collapsed"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </Grid.Style>
            <!--BorderThickness="0" BorderBrush="Transparent"-->
            <Ribbon Foreground="White"
                    Background="Black"
                    BorderBrush="Black"
                    ItemsSource="{Binding Path=RangeVm.RibbonItems,ElementName=WC}"
                    ItemContainerStyle="{StaticResource tabStyle}"/>


            <!--<TabControl Style="{StaticResource GelTabControl}">
                <TabItem Header="File" Style="{StaticResource GelTabItem}">
                    <StackPanel Orientation="Horizontal">
                        <Button Margin="5" HorizontalAlignment="Left" Height="50" Padding="5,0,5,0" Content="Run" Foreground="Wheat" Command="{Binding Path=RangeVm.RunCommandIc,ElementName=WC}" CommandParameter="{Binding}" Style="{StaticResource BorderlessButtonStyle}"/>
                        <Button Margin="5" HorizontalAlignment="Left" Height="50" Padding="5,0,5,0" Content="Stop" Foreground="Wheat" Command="{Binding Path=RangeVm.StopCommandIc,ElementName=WC}" CommandParameter="{Binding}" Style="{StaticResource BorderlessButtonStyle}"/>
                        <Button Margin="5" HorizontalAlignment="Left" Height="50" Padding="5,0,5,0" Content="Save" Foreground="Wheat" Command="{Binding Path=RangeVm.SaveCommandIc,ElementName=WC}" Style="{StaticResource BorderlessButtonStyle}"/>
                        <Button Margin="5" HorizontalAlignment="Left" Height="50" Padding="5,0,5,0" Content="Parallel" Foreground="Wheat" Click="Parallel_Click" Style="{StaticResource BorderlessButtonStyle}"/>
                    </StackPanel>
                </TabItem>
            </TabControl>-->
        </Grid>

        <Grid Grid.Row="1">
            <Grid.Style>
                <Style TargetType="{x:Type Grid}">
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Path=RangeVm.FullScreen,ElementName=WC}" Value="True">
                            <Setter Property="Visibility" Value="Collapsed"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </Grid.Style>
            <Grid.RowDefinitions>
                <RowDefinition Height="30"/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Border Grid.Row="0" Grid.Column="0" HorizontalAlignment="Stretch" Margin="5,2,5,2" CornerRadius="7">
                <TextBlock Text=" (Use Mouse Wheel for Zoom) - (F1,F2,F3 to Toggle Axis Grid lines)" Foreground="Wheat" Background="{StaticResource BlackTexture}" TextAlignment="Center" HorizontalAlignment="Stretch"/>
            </Border>
            <Border Grid.Row="0" Grid.Column="1" HorizontalAlignment="Stretch" Margin="5,2,5,2" CornerRadius="7">
                <TextBlock Text="3D Model - [Pen] - Rotation System" Foreground="Wheat" Background="{StaticResource BlackTexture}" TextAlignment="Center" HorizontalAlignment="Stretch"/>
            </Border>
            <Border Grid.Row="0" Grid.Column="2" HorizontalAlignment="Stretch" Margin="5,2,5,2" CornerRadius="7">
                <TextBlock Text="(Right Mouse Button and Mouse Move to Rotate Manually)" Foreground="Wheat" Background="{StaticResource BlackTexture}" TextAlignment="Center" HorizontalAlignment="Stretch"/>
            </Border>
            
            <Local:VariableView Grid.Row="1" />
        </Grid>

        <Grid Grid.Column="0" Grid.Row="2" 
              Grid.RowSpan="2" Grid.ColumnSpan="4" Background="Transparent"
              DataContext="{Binding Path=RangeVm,ElementName=WC}"
              >
            <Grid.Style>
                <Style TargetType="{x:Type Grid}">
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Path=RangeVm.FullScreen,ElementName=WC}" Value="True">
                            <Setter Property="Visibility" Value="Collapsed"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </Grid.Style>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="50"/>
                <ColumnDefinition Width="50"/>
                <ColumnDefinition Width="50"/>
                <ColumnDefinition Width="50"/>
                <ColumnDefinition Width="50"/>
                <ColumnDefinition Width="50"/>
                <ColumnDefinition Width="50"/>
                <ColumnDefinition Width="50"/>
                <ColumnDefinition Width="50"/>
                <ColumnDefinition Width="200"/>
                <ColumnDefinition Width="50"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="50"/>
                <RowDefinition Height="30"/>
                <RowDefinition Height="30"/>
                <RowDefinition Height="30"/>
                <RowDefinition Height="30"/>
                <RowDefinition Height="30"/>
                <RowDefinition Height="30"/>
                <RowDefinition Height="30"/>
                <RowDefinition Height="30"/>
                <RowDefinition Height="30"/>
                <RowDefinition/>
            </Grid.RowDefinitions>

            <Border Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="12" CornerRadius="7" Background="{StaticResource BlackTexture}">
                <TextBlock Text="Search Criteria" Foreground="Wheat" HorizontalAlignment="Center" TextAlignment="Center" VerticalAlignment="Center"/>
            </Border>

            <TextBlock    Margin="5,0,0,0" Grid.Row="1" Grid.Column="0" Text="W" Foreground="Wheat"/>
            <RepeatButton Margin="5,0,0,0" Grid.Row="1" Grid.Column="1" Foreground="Wheat" Style="{StaticResource RepeatBorderlessButtonStyle}" Content="&lt;" Command="{Binding Path=DecreaseWStartCommandIc}"/>
            <TextBlock    Margin="5,0,0,0" Grid.Row="1" Grid.Column="2" Text="{Binding Path=WStart}" ToolTip="WStart" Foreground="Wheat" TextAlignment="Center"/>
            <RepeatButton Margin="5,0,0,0" Grid.Row="1" Grid.Column="3" Foreground="Wheat" Style="{StaticResource RepeatBorderlessButtonStyle}" Content="&gt;" Command="{Binding Path=IncreaseWStartCommandIc}" />
            <TextBlock    Margin="5,0,0,0" Grid.Row="1" Grid.Column="4" Text="to" Foreground="Wheat"/>
            <RepeatButton Margin="5,0,0,0" Grid.Row="1" Grid.Column="5" Foreground="Wheat" Style="{StaticResource RepeatBorderlessButtonStyle}" Content="&lt;" Command="{Binding Path=DecreaseWEndCommandIc}"/>
            <TextBlock    Margin="5,0,0,0" Grid.Row="1" Grid.Column="6" Text="{Binding Path=WEnd}" TextAlignment="Center" ToolTip="WEnd" Foreground="Wheat"/>
            <RepeatButton Margin="5,0,0,0" Grid.Row="1" Grid.Column="7" Foreground="Wheat" Style="{StaticResource RepeatBorderlessButtonStyle}" Content="&gt;" Command="{Binding Path=IncreaseWEndCommandIc}"/>
            <RepeatButton Margin="5,0,0,0" Grid.Row="1" Grid.Column="8" Foreground="Wheat" Style="{StaticResource RepeatBorderlessButtonStyle}" Content="&lt;" Command="{Binding Path=DecreaseWStepCommandIc}"/>
            <TextBlock    Margin="5,0,0,0" Grid.Row="1" Grid.Column="9" Text="{Binding Path=WStep}" Background="DodgerBlue" TextAlignment="Center" ToolTip="WStep" Foreground="Wheat"/>
            <RepeatButton Margin="5,0,0,0" Grid.Row="1" Grid.Column="10" Foreground="Wheat" Style="{StaticResource RepeatBorderlessButtonStyle}" Content="&gt;" Command="{Binding Path=IncreaseWStepCommandIc}"/>

            <TextBlock    Margin="5,0,0,0" Grid.Row="2" Grid.Column="0" Text="H" Foreground="Wheat"/>
            <RepeatButton Margin="5,0,0,0" Grid.Row="2" Grid.Column="1" Foreground="Wheat" Style="{StaticResource RepeatBorderlessButtonStyle}" Content="&lt;" Command="{Binding Path=DecreaseHStartCommandIc}"/>
            <TextBlock    Margin="5,0,0,0" Grid.Row="2" Grid.Column="2" Text="{Binding Path=HStart}" ToolTip="WStart" Foreground="Wheat" TextAlignment="Center"/>
            <RepeatButton Margin="5,0,0,0" Grid.Row="2" Grid.Column="3" Foreground="Wheat" Style="{StaticResource RepeatBorderlessButtonStyle}" Content="&gt;" Command="{Binding Path=IncreaseHStartCommandIc}" />
            <TextBlock    Margin="5,0,0,0" Grid.Row="2" Grid.Column="4" Text="to" Foreground="Wheat"/>
            <RepeatButton Margin="5,0,0,0" Grid.Row="2" Grid.Column="5" Foreground="Wheat" Style="{StaticResource RepeatBorderlessButtonStyle}" Content="&lt;" Command="{Binding Path=DecreaseHEndCommandIc}"/>
            <TextBlock    Margin="5,0,0,0" Grid.Row="2" Grid.Column="6" Text="{Binding Path=HEnd}" TextAlignment="Center" ToolTip="HEnd" Foreground="Wheat"/>
            <RepeatButton Margin="5,0,0,0" Grid.Row="2" Grid.Column="7" Foreground="Wheat" Style="{StaticResource RepeatBorderlessButtonStyle}" Content="&gt;" Command="{Binding Path=IncreaseHEndCommandIc}"/>
            <RepeatButton Margin="5,0,0,0" Grid.Row="2" Grid.Column="8" Foreground="Wheat" Style="{StaticResource RepeatBorderlessButtonStyle}" Content="&lt;" Command="{Binding Path=DecreaseHStepCommandIc}"/>
            <TextBlock    Margin="5,0,0,0" Grid.Row="2" Grid.Column="9" Text="{Binding Path=HStep}" Background="DodgerBlue" TextAlignment="Center" ToolTip="HStep" Foreground="Wheat"/>
            <RepeatButton Margin="5,0,0,0" Grid.Row="2" Grid.Column="10" Foreground="Wheat" Style="{StaticResource RepeatBorderlessButtonStyle}" Content="&gt;" Command="{Binding Path=IncreaseHStepCommandIc}"/>


            <TextBlock    Margin="5,0,0,0" Grid.Row="3" Grid.Column="0" Text="D" Foreground="Wheat"/>
            <RepeatButton Margin="5,0,0,0" Grid.Row="3" Grid.Column="1" Foreground="Wheat" Style="{StaticResource RepeatBorderlessButtonStyle}" Content="&lt;" Command="{Binding Path=DecreaseDStartCommandIc}"/>
            <TextBlock    Margin="5,0,0,0" Grid.Row="3" Grid.Column="2" Text="{Binding Path=DStart}" ToolTip="DStart" Foreground="Wheat" TextAlignment="Center"/>
            <RepeatButton Margin="5,0,0,0" Grid.Row="3" Grid.Column="3" Foreground="Wheat" Style="{StaticResource RepeatBorderlessButtonStyle}" Content="&gt;" Command="{Binding Path=IncreaseDStartCommandIc}" />
            <TextBlock    Margin="5,0,0,0" Grid.Row="3" Grid.Column="4" Text="to" Foreground="Wheat"/>
            <RepeatButton Margin="5,0,0,0" Grid.Row="3" Grid.Column="5" Foreground="Wheat" Style="{StaticResource RepeatBorderlessButtonStyle}" Content="&lt;" Command="{Binding Path=DecreaseDEndCommandIc}"/>
            <TextBlock    Margin="5,0,0,0" Grid.Row="3" Grid.Column="6" Text="{Binding Path=DEnd}" TextAlignment="Center" ToolTip="DEnd" Foreground="Wheat"/>
            <RepeatButton Margin="5,0,0,0" Grid.Row="3" Grid.Column="7" Foreground="Wheat" Style="{StaticResource RepeatBorderlessButtonStyle}" Content="&gt;" Command="{Binding Path=IncreaseDEndCommandIc}"/>
            <RepeatButton Margin="5,0,0,0" Grid.Row="3" Grid.Column="8" Foreground="Wheat" Style="{StaticResource RepeatBorderlessButtonStyle}" Content="&lt;" Command="{Binding Path=DecreaseDStepCommandIc}"/>
            <TextBlock    Margin="5,0,0,0" Grid.Row="3" Grid.Column="9" Text="{Binding Path=DStep}" Background="DodgerBlue" TextAlignment="Center" ToolTip="DStep" Foreground="Wheat"/>
            <RepeatButton Margin="5,0,0,0" Grid.Row="3" Grid.Column="10" Foreground="Wheat" Style="{StaticResource RepeatBorderlessButtonStyle}" Content="&gt;" Command="{Binding Path=IncreaseDStepCommandIc}"/>


            <TextBlock    Margin="5,0,0,0" Grid.Row="4" Grid.Column="0" Text="Z" Foreground="Wheat"/>
            <RepeatButton Margin="5,0,0,0" Grid.Row="4" Grid.Column="1" Foreground="Wheat" Style="{StaticResource RepeatBorderlessButtonStyle}" Content="&lt;" Command="{Binding Path=DecreaseZStartCommandIc}"/>
            <TextBlock    Margin="5,0,0,0" Grid.Row="4" Grid.Column="2" Text="{Binding Path=ZStart}" ToolTip="ZStart" Foreground="Wheat" TextAlignment="Center"/>
            <RepeatButton Margin="5,0,0,0" Grid.Row="4" Grid.Column="3" Foreground="Wheat" Style="{StaticResource RepeatBorderlessButtonStyle}" Content="&gt;" Command="{Binding Path=IncreaseZStartCommandIc}" />
            <TextBlock    Margin="5,0,0,0" Grid.Row="4" Grid.Column="4" Text="to" Foreground="Wheat"/>
            <RepeatButton Margin="5,0,0,0" Grid.Row="4" Grid.Column="5" Foreground="Wheat" Style="{StaticResource RepeatBorderlessButtonStyle}" Content="&lt;" Command="{Binding Path=DecreaseZEndCommandIc}"/>
            <TextBlock    Margin="5,0,0,0" Grid.Row="4" Grid.Column="6" Text="{Binding Path=ZEnd}" TextAlignment="Center" ToolTip="ZEnd" Foreground="Wheat"/>
            <RepeatButton Margin="5,0,0,0" Grid.Row="4" Grid.Column="7" Foreground="Wheat" Style="{StaticResource RepeatBorderlessButtonStyle}" Content="&gt;" Command="{Binding Path=IncreaseZEndCommandIc}"/>
            <RepeatButton Margin="5,0,0,0" Grid.Row="4" Grid.Column="8" Foreground="Wheat" Style="{StaticResource RepeatBorderlessButtonStyle}" Content="&lt;" Command="{Binding Path=DecreaseZStepCommandIc}"/>
            <TextBlock    Margin="5,0,0,0" Grid.Row="4" Grid.Column="9" Text="{Binding Path=ZStep}" Background="DodgerBlue" TextAlignment="Center" ToolTip="ZStep" Foreground="Wheat"/>
            <RepeatButton Margin="5,0,0,0" Grid.Row="4" Grid.Column="10" Foreground="Wheat" Style="{StaticResource RepeatBorderlessButtonStyle}" Content="&gt;" Command="{Binding Path=IncreaseZStepCommandIc}"/>

            <TextBlock    Margin="5,0,0,0" Grid.Row="5" Grid.Column="5" Grid.ColumnSpan="3" Text="Range Start" TextAlignment="Center" ToolTip="ZEnd" Foreground="Wheat"/>
            <RepeatButton Margin="5,0,0,0" Grid.Row="5" Grid.Column="8" Foreground="Wheat" Style="{StaticResource RepeatBorderlessButtonStyle}" Content="&lt;" Command="{Binding Path=DecreaseStartRangeCommandIc}"/>
            <TextBlock    Margin="5,0,0,0" Grid.Row="5" Grid.Column="9" Text="{Binding Path=StartRange}" Background="SeaGreen" Foreground="Black" TextAlignment="Center" ToolTip="Range Start" />
            <RepeatButton Margin="5,0,0,0" Grid.Row="5" Grid.Column="10" Foreground="Wheat" Style="{StaticResource RepeatBorderlessButtonStyle}" Content="&gt;" Command="{Binding Path=IncreaseStartRangeCommandIc}"/>

            <TextBlock    Margin="5,0,0,0" Grid.Row="6" Grid.Column="5" Grid.ColumnSpan="3" Text="Range End" TextAlignment="Center" ToolTip="ZEnd" Foreground="Wheat"/>
            <RepeatButton Margin="5,0,0,0" Grid.Row="6" Grid.Column="8" Foreground="Wheat" Style="{StaticResource RepeatBorderlessButtonStyle}" Content="&lt;" Command="{Binding Path=DecreaseEndRangeCommandIc}"/>
            <TextBlock    Margin="5,0,0,0" Grid.Row="6" Grid.Column="9" Text="{Binding Path=EndRange}" Background="SeaGreen" Foreground="Black" TextAlignment="Center" ToolTip="Range End" />
            <RepeatButton Margin="5,0,0,0" Grid.Row="6" Grid.Column="10" Foreground="Wheat" Style="{StaticResource RepeatBorderlessButtonStyle}" Content="&gt;" Command="{Binding Path=IncreaseEndRangeCommandIc}"/>
            

        </Grid>

        <Grid Grid.Row="1" Grid.Column="4">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <Border Grid.Column="0" BorderBrush="Black" CornerRadius="7" BorderThickness="5" Margin="5,30,5,5">
                <h:HelixViewport3D x:Name="HelixTestViewport" Background="Transparent" Grid.Row = "1" Grid.Column = "0" Loaded="HelixTestViewport_Loaded" ShowViewCube="False"
                           CameraChanged="HelixTestViewport_CameraChanged"
                           >
            <h:HelixViewport3D.Resources>
                <Storyboard x:Key="SpinModelX" >
                    <DoubleAnimation Duration="0:0:30" 
                                     Storyboard.TargetName="MainModelX"
                                     Storyboard.TargetProperty="Angle" From="0" To="360" RepeatBehavior="Forever"/>
                </Storyboard>

                <Storyboard x:Key="SpinModelY" >
                    <DoubleAnimation Duration="0:0:30" 
                                     Storyboard.TargetName="MainModelY"
                                     Storyboard.TargetProperty="Angle" From="0" To="360" RepeatBehavior="Forever"/>
                </Storyboard>

                <Storyboard x:Key="SpinModelZ" >
                    <DoubleAnimation Duration="0:0:30" 
                                     Storyboard.TargetName="MainModelZ"
                                     Storyboard.TargetProperty="Angle" From="0" To="360" RepeatBehavior="Forever"/>
                </Storyboard>


                <Storyboard x:Key="SpinTextX" >
                    <DoubleAnimation Duration="0:0:30" 
                                     Storyboard.TargetName="TextModelX"
                                     Storyboard.TargetProperty="Angle" From="0" To="360" RepeatBehavior="Forever"/>
                </Storyboard>

                <Storyboard x:Key="SpinTextY" >
                    <DoubleAnimation Duration="0:0:30" 
                                     Storyboard.TargetName="TextModelY"
                                     Storyboard.TargetProperty="Angle" From="0" To="360" RepeatBehavior="Forever"/>
                </Storyboard>

                <Storyboard x:Key="SpinTextZ" >
                    <DoubleAnimation Duration="0:0:30" 
                                     Storyboard.TargetName="TextModelZ"
                                     Storyboard.TargetProperty="Angle" From="0" To="360" RepeatBehavior="Forever"/>
                </Storyboard>
            </h:HelixViewport3D.Resources>
            <h:DefaultLights />
            <h:GridLinesVisual3D Visible="{Binding Path=ShowGridX}"/>
            <h:GridLinesVisual3D Visible="{Binding Path=ShowGridY}">
                <h:GridLinesVisual3D.Transform>
                    <RotateTransform3D>
                        <RotateTransform3D.Rotation>
                            <AxisAngleRotation3D Angle="90" Axis="0,1,0"/>
                        </RotateTransform3D.Rotation>
                    </RotateTransform3D>
                </h:GridLinesVisual3D.Transform>
            </h:GridLinesVisual3D>
            <h:GridLinesVisual3D Visible="{Binding Path=ShowGridZ}">
                <h:GridLinesVisual3D.Transform>
                    <RotateTransform3D>
                        <RotateTransform3D.Rotation>
                            <AxisAngleRotation3D Angle="90" Axis="1,0,0"/>
                        </RotateTransform3D.Rotation>
                    </RotateTransform3D>
                </h:GridLinesVisual3D.Transform>
            </h:GridLinesVisual3D>
            <ModelVisual3D Content="{Binding Path=MainModel3DGroup}">
                <ModelVisual3D.Transform>
                    <Transform3DGroup>
                        <RotateTransform3D>
                            <RotateTransform3D.Rotation>
                                <AxisAngleRotation3D x:Name="MainModelX" Axis="1,0,0" />
                            </RotateTransform3D.Rotation>
                        </RotateTransform3D>

                        <RotateTransform3D>
                            <RotateTransform3D.Rotation>
                                <AxisAngleRotation3D x:Name="MainModelY" Axis="0,1,0" />
                            </RotateTransform3D.Rotation>
                        </RotateTransform3D>

                        <RotateTransform3D>
                            <RotateTransform3D.Rotation>
                                <AxisAngleRotation3D x:Name="MainModelZ" Axis="0,0,1" />
                            </RotateTransform3D.Rotation>
                        </RotateTransform3D>
                        
                    </Transform3DGroup>
                </ModelVisual3D.Transform>
            </ModelVisual3D>
            <ModelVisual3D Content="{Binding Path=TextModel3DGroup}">
                <ModelVisual3D.Transform>
                    <Transform3DGroup>
                        <RotateTransform3D>
                            <RotateTransform3D.Rotation>
                                <AxisAngleRotation3D x:Name="TextModelX" Axis="1,0,0" />
                            </RotateTransform3D.Rotation>
                        </RotateTransform3D>

                        <RotateTransform3D>
                            <RotateTransform3D.Rotation>
                                <AxisAngleRotation3D x:Name="TextModelY" Axis="0,1,0" />
                            </RotateTransform3D.Rotation>
                        </RotateTransform3D>

                        <RotateTransform3D>
                            <RotateTransform3D.Rotation>
                                <AxisAngleRotation3D x:Name="TextModelZ" Axis="0,0,1" />
                            </RotateTransform3D.Rotation>
                        </RotateTransform3D>

                    </Transform3DGroup>
                </ModelVisual3D.Transform>
            </ModelVisual3D>
        </h:HelixViewport3D>
            </Border>

            <Border Grid.Column="1"  BorderBrush="Black" CornerRadius="7" BorderThickness="5" Margin="5,30,5,5">
                <h:HelixViewport3D x:Name="HelixTestViewport2" IsHitTestVisible="False" Loaded="HelixTestViewport2_Loaded" Background="Transparent" Grid.Row = "1" Grid.Column = "1" ShowViewCube="False">
                <h:HelixViewport3D.Resources>
                    <Storyboard x:Key="SpinModelXPanel2" >
                        <DoubleAnimation Duration="0:0:30" 
                                     Storyboard.TargetName="MainModelX2"
                                     Storyboard.TargetProperty="Angle" From="0" To="360" RepeatBehavior="Forever"/>
                    </Storyboard>

                    <Storyboard x:Key="SpinModelYPanel2" >
                        <DoubleAnimation Duration="0:0:30" 
                                     Storyboard.TargetName="MainModelY2"
                                     Storyboard.TargetProperty="Angle" From="0" To="360" RepeatBehavior="Forever"/>
                    </Storyboard>

                    <Storyboard x:Key="SpinModelZPanel2" >
                        <DoubleAnimation Duration="0:0:30" 
                                     Storyboard.TargetName="MainModelZ2"
                                     Storyboard.TargetProperty="Angle" From="0" To="360" RepeatBehavior="Forever"/>
                    </Storyboard>


                    <Storyboard x:Key="SpinTextXPanel2" >
                        <DoubleAnimation Duration="0:0:30" 
                                     Storyboard.TargetName="TextModelX2"
                                     Storyboard.TargetProperty="Angle" From="0" To="360" RepeatBehavior="Forever"/>
                    </Storyboard>

                        <Storyboard x:Key="SpinTextYPanel2" >
                        <DoubleAnimation Duration="0:0:30" 
                                     Storyboard.TargetName="TextModelY2"
                                     Storyboard.TargetProperty="Angle" From="0" To="360" RepeatBehavior="Forever"/>
                    </Storyboard>

                        <Storyboard x:Key="SpinTextZPanel2" >
                        <DoubleAnimation Duration="0:0:30" 
                                     Storyboard.TargetName="TextModelZ2"
                                     Storyboard.TargetProperty="Angle" From="0" To="360" RepeatBehavior="Forever"/>
                    </Storyboard>
                </h:HelixViewport3D.Resources>
                <h:DefaultLights />
                <h:GridLinesVisual3D Visible="{Binding Path=ShowGridX}"/>
                <h:GridLinesVisual3D Visible="{Binding Path=ShowGridY}">
                    <h:GridLinesVisual3D.Transform>
                        <RotateTransform3D>
                            <RotateTransform3D.Rotation>
                                <AxisAngleRotation3D Angle="90" Axis="0,1,0"/>
                            </RotateTransform3D.Rotation>
                        </RotateTransform3D>
                    </h:GridLinesVisual3D.Transform>
                </h:GridLinesVisual3D>
                <h:GridLinesVisual3D Visible="{Binding Path=ShowGridZ}">
                    <h:GridLinesVisual3D.Transform>
                        <RotateTransform3D>
                            <RotateTransform3D.Rotation>
                                <AxisAngleRotation3D Angle="90" Axis="1,0,0"/>
                            </RotateTransform3D.Rotation>
                        </RotateTransform3D>
                    </h:GridLinesVisual3D.Transform>
                </h:GridLinesVisual3D>
                <ModelVisual3D Content="{Binding Path=MainModel3DGroup}">
                    <ModelVisual3D.Transform>
                        <Transform3DGroup>
                            <RotateTransform3D>
                                <RotateTransform3D.Rotation>
                                    <AxisAngleRotation3D x:Name="MainModelX2" Axis="1,0,0" />
                                </RotateTransform3D.Rotation>
                            </RotateTransform3D>

                            <RotateTransform3D>
                                <RotateTransform3D.Rotation>
                                    <AxisAngleRotation3D x:Name="MainModelY2" Axis="0,1,0" />
                                </RotateTransform3D.Rotation>
                            </RotateTransform3D>

                            <RotateTransform3D>
                                <RotateTransform3D.Rotation>
                                    <AxisAngleRotation3D x:Name="MainModelZ2" Axis="0,0,1" />
                                </RotateTransform3D.Rotation>
                            </RotateTransform3D>

                        </Transform3DGroup>
                    </ModelVisual3D.Transform>
                </ModelVisual3D>
                <ModelVisual3D Content="{Binding Path=TextModel3DGroup}">
                    <ModelVisual3D.Transform>
                        <Transform3DGroup>
                            <RotateTransform3D>
                                <RotateTransform3D.Rotation>
                                    <AxisAngleRotation3D x:Name="TextModelX2" Axis="1,0,0" />
                                </RotateTransform3D.Rotation>
                            </RotateTransform3D>

                            <RotateTransform3D>
                                <RotateTransform3D.Rotation>
                                    <AxisAngleRotation3D x:Name="TextModelY2" Axis="0,1,0" />
                                </RotateTransform3D.Rotation>
                            </RotateTransform3D>

                            <RotateTransform3D>
                                <RotateTransform3D.Rotation>
                                    <AxisAngleRotation3D x:Name="TextModelZ2" Axis="0,0,1" />
                                </RotateTransform3D.Rotation>
                            </RotateTransform3D>

                        </Transform3DGroup>
                    </ModelVisual3D.Transform>
                </ModelVisual3D>
            </h:HelixViewport3D>
            </Border>
        </Grid>

        <TabControl Grid.Row="3" Grid.Column="4" SelectedIndex="0" Tag="{Binding Path=CanvasItems.Items.Count,Mode=OneWay}">
            <TabControl.Style>
                <Style TargetType="{x:Type TabControl}" BasedOn="{StaticResource GelTabControl}">
                    <!--<Setter Property="Height" Value="500"/>-->
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Path=RangeVm.FullScreen,ElementName=WC}" Value="True">
                            <Setter Property="Visibility" Value="Collapsed"/>
                            <!--<Setter Property="Height" Value="0"/>-->
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </TabControl.Style>
            <TabItem Header="Equations" Style="{StaticResource GelTabItem}">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition/>
                        <RowDefinition Height="40"/>
                    </Grid.RowDefinitions>

                    <Border Grid.Row="1" >
                    <ItemsControl ItemsSource="{Binding Path=SlateInfos}">
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Button
                                    Command="{Binding Path=Data.ChangeSlateCommandIc,Source={StaticResource MainViewModelDataContext}}"
                                    CommandParameter="{Binding}"
                                    Style="{StaticResource BorderlessButtonStyle}">
                                    <Border Margin="5,0,5,0" CornerRadius="7" Background="Black">
                                            <TextBlock Padding="5,0,5,0" Text="{Binding Path=Name, Mode=OneWay}">
                                                <TextBlock.Style>
                                                    <Style TargetType="{x:Type TextBlock}">
                                                        <Setter Property="Foreground" Value="Wheat"/>
                                                        <Style.Triggers>
                                                            <DataTrigger Binding="{Binding Path=IsSelected}" Value="True">
                                                                <Setter Property="Foreground" Value="Green"/>
                                                            </DataTrigger>
                                                        </Style.Triggers>
                                                    </Style>
                                                </TextBlock.Style>
                                            </TextBlock>
                                        </Border>
                                </Button>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <VirtualizingStackPanel Orientation="Horizontal" IsItemsHost="True"/>
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                    </ItemsControl>
                </Border>

                    <ItemsControl Grid.Row="0" Behaviors:Zoom.EnableMouseWheel="True" ItemsSource="{Binding Path=CanvasItems.Items}">
         
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <Button 
                                Width="{Binding Path=Width,Mode=OneWay}"
                                Height="{Binding Path=Height,Mode=OneWay}"
                                Command="{Binding Path=Command,Mode=OneWay}"
                                CommandParameter="{Binding Mode=OneWay}"          
                                Visibility="{Binding Path=IsVisible,Converter={StaticResource bool2VisibilityConverter}}"
                                >
                                <Button.Style>
                                    <Style TargetType="{x:Type Button}" BasedOn="{StaticResource CanvasElementButtonStyle}">
                                        <Setter Property="Content">
                                            <Setter.Value>
                                                <Border Height="{Binding Path=Height,Mode=OneWay}" VerticalAlignment="Center">
                                                    <Grid>
                                                        <TextBlock Text="{Binding Path=OverscriptDisplayText}" VerticalAlignment="Top" HorizontalAlignment="Center"/>
                                                        <Viewbox VerticalAlignment="Center">
                                                            <TextBlock
                                                                Foreground="{Binding Path=Foreground,Mode=OneWay,RelativeSource={RelativeSource AncestorType={x:Type Button}}}" 
                                                                Text="{Binding Path=DisplayText,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}"
                                                                VerticalAlignment="Center"
                                                                Height="{Binding Path=Height,Mode=OneWay}" 
                                                                FontSize="14"
                                                            />
                                                        </Viewbox>
                                                    </Grid>
                                                </Border>
                                            </Setter.Value>
                                        </Setter>
                                        <Style.Triggers>

                                            <DataTrigger Binding="{Binding Path=ElementRenderMode}" Value="Transparent">
                                                <Setter Property="Background" Value="Transparent"/>
                                                <Setter Property="BorderBrush" Value="Transparent"/>
                                                <Setter Property="Foreground" Value="White"/>
                                            </DataTrigger>
                                            <DataTrigger Binding="{Binding Path=ElementRenderMode}" Value="Divide">
                                                <Setter Property="Background" Value="Transparent"/>
                                                <Setter Property="BorderBrush" Value="Transparent"/>
                                                <Setter Property="Foreground" Value="White"/>
                                                <Setter Property="Content" Value="-----"/>
                                            </DataTrigger>

                                            <MultiDataTrigger>
                                                <MultiDataTrigger.Conditions>
                                                    <Condition Binding="{Binding Path=ElementRenderMode}" Value="Transparent"/>
                                                    <Condition Binding="{Binding Path=IsEnabled}" Value="False"/>
                                                </MultiDataTrigger.Conditions>
                                                <MultiDataTrigger.Setters>
                                                    <Setter Property="Background" Value="Transparent"/>
                                                    <Setter Property="BorderBrush" Value="Transparent"/>
                                                    <Setter Property="Foreground" Value="Gray"/>
                                                </MultiDataTrigger.Setters>
                                            </MultiDataTrigger>

                                            <MultiDataTrigger>
                                                <MultiDataTrigger.Conditions>
                                                    <Condition Binding="{Binding Path=ElementRenderMode}" Value="Divide"/>
                                                    <Condition Binding="{Binding Path=IsEnabled}" Value="False"/>
                                                </MultiDataTrigger.Conditions>
                                                <MultiDataTrigger.Setters>
                                                    <Setter Property="Background" Value="Transparent"/>
                                                    <Setter Property="BorderBrush" Value="Transparent"/>
                                                    <Setter Property="Foreground" Value="Gray"/>
                                                    <Setter Property="Content" Value="-----"/>
                                                </MultiDataTrigger.Setters>
                                            </MultiDataTrigger>

                                            <!--<DataTrigger Binding="{Binding Path=Data.SelectedEquationRenderMode,Source={StaticResource MainViewModelDataContext}}" Value="Group">
                                        <Setter Property="Background" Value="{Binding Path=GroupBrushColor,Converter={StaticResource CustomColorConverter}}"/>
                                        <Setter Property="Foreground" Value="Black"/>
                                    </DataTrigger>

                                    <DataTrigger Binding="{Binding Path=Data.SelectedEquationRenderMode,Source={StaticResource MainViewModelDataContext}}" Value="Equation">
                                        <Setter Property="Background" Value="{Binding Path=GroupBrushColor,Converter={StaticResource CustomColorConverter}}"/>
                                        <Setter Property="Foreground" Value="Black"/>
                                    </DataTrigger>-->

                                        </Style.Triggers>
                                    </Style>
                                </Button.Style>
                            </Button>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <Canvas IsItemsHost="True"/>
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                </ItemsControl>
                </Grid>
            </TabItem>

            <TabItem Header="Matches" Style="{StaticResource GelTabItem}" Tag="{Binding Path=RangeVm.MatchResults.Count,Mode=OneWay,ElementName=WC}">
                <ItemsControl 
                    Behaviors:Zoom.EnableMouseWheel="True" 
                    ItemsSource="{Binding Path=RangeVm.MatchResults,ElementName=WC}" Background="Transparent">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <Button Style="{StaticResource BorderlessButtonStyle}" Command="{Binding Path=RangeVm.SelectItemCommandIc,ElementName=WC}" CommandParameter="{Binding}">
                                <Border Margin="5" Width="480" Height="240" CornerRadius="7" Background="Transparent">
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="30"/>
                                        <RowDefinition Height="30"/>
                                        <RowDefinition/>
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="50"/>
                                        <ColumnDefinition/>
                                        <ColumnDefinition Width="50"/>
                                        <ColumnDefinition/>
                                        <ColumnDefinition Width="50"/>
                                        <ColumnDefinition/>
                                        <ColumnDefinition Width="50"/>
                                        <ColumnDefinition/>
                                    </Grid.ColumnDefinitions>
                                    
                                    <TextBlock Grid.Row="0" Grid.Column="0" Text="W"/>
                                    <TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Path=W,Mode=OneWay}"/>

                                    <TextBlock Grid.Row="0" Grid.Column="2" Text="H"/>
                                    <TextBlock Grid.Row="0" Grid.Column="3" Text="{Binding Path=H,Mode=OneWay}"/>
                                    
                                    <TextBlock Grid.Row="0" Grid.Column="4" Text="D"/>
                                    <TextBlock Grid.Row="0" Grid.Column="5" Text="{Binding Path=D,Mode=OneWay}"/>

                                    <TextBlock Grid.Row="0" Grid.Column="6" Text="Z"/>
                                    <TextBlock Grid.Row="0" Grid.Column="7" Text="{Binding Path=Z,Mode=OneWay}"/>

                                    <Grid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="8">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="75"/>
                                            <ColumnDefinition/>
                                        </Grid.ColumnDefinitions>
                                        <TextBlock Grid.Row="0" Grid.Column="0" Text="CuFt"/>
                                        <TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding Path=CuFt,Mode=OneWay}"/>
                                    </Grid>

                                        <h:HelixViewport3D Background="Transparent" Grid.Row = "2" Grid.Column = "0" Grid.ColumnSpan="8" >
                                            <h:DefaultLights />
                                            <ModelVisual3D Content="{Binding Path=Model}"/>
                                        </h:HelixViewport3D>
                                    </Grid>
                            </Border>
                            </Button>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <WrapPanel IsItemsHost="True" ItemWidth="500" ItemHeight="250" Width="{Binding Path=ActualWidth,RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                </ItemsControl>
            </TabItem>

            <TabItem Header="Canvas Data" Tag="{Binding Path=CanvasItems.Items.Count,Mode=OneWay}" Style="{StaticResource GelTabItem}">
                <DataGrid ItemsSource="{Binding Path=CanvasItems.Items}" Background="#333333" AutoGenerateColumns="True"/>
            </TabItem>
        </TabControl>
    </Grid>
</Window>