<UserControl x:Class="Ion.Sdk.DemoApp.Views.PadfxBrowser"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:local="clr-namespace:Ion.Sdk.DemoApp.Views"
             xmlns:converters="clr-namespace:Ion.Sdk.DemoApp.Views.Converters"
             xmlns:ddr="clr-namespace:Ion.Sdk.Ddr;assembly=Ion.Sdk.Ddr"
             xmlns:models="clr-namespace:Ion.Sdk.DemoApp.Models"
             xmlns:viewModels="clr-namespace:Ion.Sdk.DemoApp.Views.ViewModels"
             xmlns:system="clr-namespace:System;assembly=mscorlib"
             xmlns:demo="clr-namespace:Ion.Sdk.DemoApp"
             xmlns:components="clr-namespace:Ion.Sdk.DemoApp.Components"
             xmlns:graph="clr-namespace:Ion.Sdk.DemoApp.Views.ViewModels.Graph"
             xmlns:controls="clr-namespace:Ion.Sdk.DemoApp.Views.Controls;assembly=Ion.Sdk.DemoApp.Shared"
             xmlns:sharedVM="clr-namespace:Ion.Sdk.DemoApp.Views.ViewModels;assembly=Ion.Sdk.DemoApp.Shared"
             xmlns:idi="clr-namespace:Ion.Sdk.Idi;assembly=Ion.Sdk.Idi"
             x:Name="View"
             mc:Ignorable="d"
             d:DesignHeight="300"
             d:DesignWidth="300">
    <UserControl.Resources>
        <sharedVM:MeasurementToViewModelConverter x:Key="MeasurementToViewModelConverter" />
        <converters:InfoToTextConverter x:Key="InfoToTextConverter" />
        <converters:StructureObjectHasChildrenToBooleanConverter x:Key="StructureObjectHasChildrenToBooleanConverter" />
        <converters:IEnumerableToTestListConverter x:Key="IEnumerableToTestListConverter" />
        <converters:ValueToTextConverter x:Key="ValueToTextConverter" />
        <viewModels:InspectionToViewModelConverter x:Key="InspectionViewModelConverter" />
        <viewModels:StructureObjectViewModelConverter x:Key="StructureObjectViewModelConverter" />
        <SolidColorBrush x:Key="Brush.Instrument"
                         Color="#785B47" />
        <SolidColorBrush x:Key="Brush.User"
                         Color="#275FC5" />
        <Style x:Key="TextBlock.Comment"
               TargetType="TextBlock"
               BasedOn="{StaticResource TextBlock.Content}">
            <Setter Property="FontSize"
                    Value="{StaticResource Font.Size.Tiny}" />
            <Setter Property="Opacity"
                    Value="0.5" />
            <Setter Property="Visibility"
                    Value="Visible" />
            <Style.Triggers>
                <Trigger Property="Text"
                         Value="">
                    <Setter Property="Visibility"
                            Value="Collapsed" />
                </Trigger>
            </Style.Triggers>
        </Style>
        <DataTemplate DataType="{x:Type idi:StructureObject+StructureObjectList}">
            <ItemsControl ItemsSource="{Binding Mode=OneWay}" />
        </DataTemplate>
        <DataTemplate DataType="{x:Type idi:Instrument}">
            <DataTemplate.Resources>
                <Style x:Key="Instrument.Image"
                       TargetType="ContentControl">
                    <Setter Property="Width"
                            Value="20" />
                    <Setter Property="Content"
                            Value="{Binding}" />
                    <Setter Property="ContentTemplate">
                        <Setter.Value>
                            <DataTemplate>
                                <Viewbox Stretch="Uniform"
                                         Width="8">
                                    <Path Stretch="Uniform"
                                          Fill="{StaticResource Brush.Instrument}"
                                          Data="{StaticResource Geometry.Instrument}" />
                                </Viewbox>
                            </DataTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </DataTemplate.Resources>
            <Grid HorizontalAlignment="Left">
                <Border BorderThickness="0 0 0 1"
                        BorderBrush="Black"
                        Opacity="0.05" />
                <Grid Margin="2 0">
                    <Grid.Resources>
                        <Style TargetType="TextBox"
                               BasedOn="{StaticResource TextBox.Undefined}">
                            <Setter Property="FontSize"
                                    Value="{StaticResource Font.Size.Small}" />
                            <Setter Property="Margin"
                                    Value="{StaticResource Margin.Text}" />
                            <Setter Property="VerticalAlignment"
                                    Value="Center" />
                            <Setter Property="IsReadOnly"
                                    Value="True" />
                        </Style>
                    </Grid.Resources>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"
                                          SharedSizeGroup="Instrument_MetrelInstrumentName" />
                        <ColumnDefinition Width="Auto"
                                          SharedSizeGroup="Instrument_Guid" />
                        <ColumnDefinition Width="Auto"
                                          SharedSizeGroup="Instrument_HardwareVersion" />
                        <ColumnDefinition Width="Auto"
                                          SharedSizeGroup="Instrument_SoftwareVersion" />
                    </Grid.ColumnDefinitions>
                    <StackPanel Orientation="Horizontal"
                                Grid.Column="0">
                        <ContentControl x:Name="Image"
                                        Style="{StaticResource Instrument.Image }" />
                        <TextBox Text="{Binding Path=MetrelInstrumentName, Mode=OneWay}" />
                    </StackPanel>
                    <TextBox Grid.Column="1"
                             Text="{Binding Path=Guid, Mode=OneWay}" />
                    <TextBox Grid.Column="2"
                             Text="{Binding Path=HardwareVersion, Mode=OneWay}" />
                    <TextBox Grid.Column="3"
                             Text="{Binding Path=SoftwareVersion, Mode=OneWay}" />
                </Grid>
            </Grid>
        </DataTemplate>
        <DataTemplate DataType="{x:Type idi:User}">
            <DataTemplate.Resources>
                <Style x:Key="User.Image"
                       TargetType="ContentControl">
                    <Setter Property="Width"
                            Value="20" />
                    <Setter Property="Content"
                            Value="{Binding}" />
                    <Setter Property="ContentTemplate">
                        <Setter.Value>
                            <DataTemplate>
                                <Viewbox Stretch="Uniform"
                                         Width="8">
                                    <Path Stretch="Uniform"
                                          Fill="{StaticResource Brush.User}"
                                          Data="{StaticResource Geometry.User}" />
                                </Viewbox>
                            </DataTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </DataTemplate.Resources>
            <Grid HorizontalAlignment="Left">
                <Border BorderThickness="0 0 0 1"
                        BorderBrush="Black"
                        Opacity="0.05" />
                <Grid Margin="2 0">
                    <Grid.Resources>
                        <Style TargetType="TextBox"
                               BasedOn="{StaticResource TextBox.Undefined}">
                            <Setter Property="FontSize"
                                    Value="{StaticResource Font.Size.Small}" />
                            <Setter Property="Margin"
                                    Value="{StaticResource Margin.Text}" />
                            <Setter Property="VerticalAlignment"
                                    Value="Center" />
                            <Setter Property="IsReadOnly"
                                    Value="True" />
                        </Style>
                    </Grid.Resources>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"
                                          SharedSizeGroup="User_Name" />
                        <ColumnDefinition Width="Auto"
                                          SharedSizeGroup="User_Guid" />
                    </Grid.ColumnDefinitions>
                    <StackPanel Orientation="Horizontal"
                                Grid.Column="0">
                        <ContentControl x:Name="Image"
                                        Style="{StaticResource User.Image }" />
                        <TextBox Text="{Binding Path=Name, Mode=OneWay}" />
                    </StackPanel>
                    <TextBox Grid.Column="1"
                             Text="{Binding Path=Guid, Mode=OneWay}" />
                </Grid>
            </Grid>
        </DataTemplate>
        <DataTemplate DataType="{x:Type models:TestsCollection}">
            <ItemsControl ItemsSource="{Binding Mode=OneWay}" />
        </DataTemplate>
        <DataTemplate DataType="{x:Type models:MeasurementsCollection}">
            <ItemsControl ItemsSource="{Binding Mode=OneWay}" />
        </DataTemplate>
        <DataTemplate DataType="{x:Type idi:Measurement}">
            <DataTemplate.Resources>
                <Style x:Key="MeasurementParameter.Image"
                       TargetType="ContentControl">
                    <Setter Property="Width"
                            Value="20" />
                    <Setter Property="Content"
                            Value="{Binding}" />
                    <Setter Property="ContentTemplate">
                        <Setter.Value>
                            <DataTemplate>
                                <Viewbox Stretch="Uniform"
                                         Width="8">
                                    <Path Stretch="Uniform"
                                          Fill="#BB7F58"
                                          Data="{StaticResource Geometry.MeasurementParameter}" />
                                </Viewbox>
                            </DataTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
                <Style x:Key="MeasurementResultLimit.Image"
                       TargetType="ContentControl">
                    <Setter Property="Width"
                            Value="20" />
                    <Setter Property="Content"
                            Value="{Binding}" />
                    <Setter Property="ContentTemplate">
                        <Setter.Value>
                            <DataTemplate>
                                <Viewbox Stretch="Uniform"
                                         Width="7">
                                    <Path Stretch="Uniform"
                                          Fill="#767078"
                                          Data="{StaticResource Geometry.MeasurementResultLimit}" />
                                </Viewbox>
                            </DataTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
                <Style x:Key="MeasurementResult.Image"
                       TargetType="ContentControl">
                    <Setter Property="Width"
                            Value="20" />
                    <Setter Property="Content"
                            Value="{Binding}" />
                    <Setter Property="ContentTemplate">
                        <Setter.Value>
                            <DataTemplate>
                                <Viewbox Stretch="Uniform"
                                         Width="8">
                                    <Path Stretch="Uniform"
                                          Fill="#8308C9"
                                          Data="{StaticResource Geometry.MeasurementResult}" />
                                </Viewbox>
                            </DataTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
                <Style x:Key="MeasurementGraph.Image"
                       TargetType="ContentControl">
                    <Setter Property="Width"
                            Value="20" />
                    <Setter Property="Content"
                            Value="{Binding}" />
                    <Setter Property="ContentTemplate">
                        <Setter.Value>
                            <DataTemplate>
                                <Viewbox Stretch="Uniform"
                                         Width="8">
                                    <Path Stretch="Uniform"
                                          Fill="PaleVioletRed"
                                          Data="{StaticResource Geometry.MeasurementGraph}" />
                                </Viewbox>
                            </DataTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
                <Style x:Key="User.Image"
                       TargetType="ContentControl">
                    <Setter Property="Width"
                            Value="20" />
                    <Setter Property="Content"
                            Value="{Binding}" />
                    <Setter Property="ContentTemplate">
                        <Setter.Value>
                            <DataTemplate>
                                <Viewbox Stretch="Uniform"
                                         Width="8">
                                    <Path Stretch="Uniform"
                                          Fill="{StaticResource Brush.User}"
                                          Data="{StaticResource Geometry.User}" />
                                </Viewbox>
                            </DataTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
                <DataTemplate DataType="{x:Type idi:MeasurementParameter}">
                    <Grid HorizontalAlignment="Left">
                        <Border BorderThickness="0 0 0 1"
                                BorderBrush="Black"
                                Opacity="0.05" />
                        <StackPanel Orientation="Horizontal"
                                    Margin="2 0">
                            <ContentControl x:Name="Image"
                                            Style="{StaticResource MeasurementParameter.Image }" />
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"
                                                      SharedSizeGroup="Parameter.Name" />
                                    <ColumnDefinition Width="Auto"
                                                      SharedSizeGroup="Parameter.Value" />
                                </Grid.ColumnDefinitions>
                                <TextBlock Grid.Column="0"
                                           Text="{Binding Path=Info, Mode=OneWay, Converter={StaticResource InfoToTextConverter}}"
                                           Margin="{StaticResource Margin.Text}"
                                           VerticalAlignment="Center"
                                           Style="{StaticResource TextBlock.Content}"
                                           FontSize="{StaticResource Font.Size.Small}" />
                                <ContentControl Grid.Column="1"
                                                Margin="20 0 0 0">
                                    <TextBlock Text="{Binding Path=Value, Mode=OneWay, Converter={StaticResource ValueToTextConverter}}"
                                               VerticalAlignment="Center"
                                               Margin="{StaticResource Margin.Text}"
                                               Style="{StaticResource TextBlock.Content}"
                                               FontSize="{StaticResource Font.Size.Small}"
                                               Foreground="{StaticResource Brush.Accent.Strong}" />
                                </ContentControl>
                            </Grid>
                        </StackPanel>
                    </Grid>
                </DataTemplate>
                <DataTemplate DataType="{x:Type idi:MeasurementResultLimit}">
                    <Grid HorizontalAlignment="Left">
                        <Border BorderThickness="0 0 0 1"
                                BorderBrush="Black"
                                Opacity="0.05" />
                        <StackPanel Orientation="Horizontal"
                                    Margin="2 0">
                            <ContentControl x:Name="Image"
                                            Style="{StaticResource MeasurementResultLimit.Image }" />
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"
                                                      SharedSizeGroup="Limit.Name" />
                                    <ColumnDefinition Width="Auto"
                                                      SharedSizeGroup="Limit.Value" />
                                </Grid.ColumnDefinitions>
                                <TextBlock Grid.Column="0"
                                           Text="{Binding Path=Info, Mode=OneWay, Converter={StaticResource InfoToTextConverter}}"
                                           Margin="{StaticResource Margin.Text}"
                                           VerticalAlignment="Center"
                                           Style="{StaticResource TextBlock.Content}"
                                           FontSize="{StaticResource Font.Size.Small}" />
                                <ContentControl Grid.Column="1"
                                                Margin="20 0 0 0">
                                    <TextBlock Text="{Binding Path=Value, Mode=OneWay, Converter={StaticResource ValueToTextConverter}}"
                                               VerticalAlignment="Center"
                                               Margin="{StaticResource Margin.Text}"
                                               Style="{StaticResource TextBlock.Content}"
                                               FontSize="{StaticResource Font.Size.Small}"
                                               Foreground="{StaticResource Brush.Accent.Strong}" />
                                </ContentControl>
                            </Grid>
                        </StackPanel>
                    </Grid>
                </DataTemplate>
                <DataTemplate DataType="{x:Type idi:MeasurementResult}">
                    <Grid HorizontalAlignment="Left">
                        <Border BorderThickness="0 0 0 1"
                                BorderBrush="Black"
                                Opacity="0.05" />
                        <StackPanel Orientation="Horizontal"
                                    Margin="2 0">
                            <ContentControl x:Name="Image"
                                            Style="{StaticResource MeasurementResult.Image }" />
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"
                                                      SharedSizeGroup="Limit.Name" />
                                    <ColumnDefinition Width="Auto"
                                                      SharedSizeGroup="Limit.Value" />
                                </Grid.ColumnDefinitions>
                                <TextBlock Grid.Column="0"
                                           Text="{Binding Path=Info, Mode=OneWay, Converter={StaticResource InfoToTextConverter}}"
                                           Margin="{StaticResource Margin.Text}"
                                           VerticalAlignment="Center"
                                           Style="{StaticResource TextBlock.Content}"
                                           FontSize="{StaticResource Font.Size.Small}" />
                                <ContentControl Grid.Column="1"
                                                Margin="20 0 0 0">
                                    <TextBlock Text="{Binding Path=Value, Mode=OneWay, Converter={StaticResource ValueToTextConverter}}"
                                               VerticalAlignment="Center"
                                               Margin="{StaticResource Margin.Text}"
                                               Style="{StaticResource TextBlock.Content}"
                                               FontSize="{StaticResource Font.Size.Small}"
                                               Foreground="{StaticResource Brush.Accent.Strong}" />
                                </ContentControl>
                            </Grid>
                        </StackPanel>
                    </Grid>
                </DataTemplate>
                <DataTemplate DataType="{x:Type idi:MeasurementGraph}">
                    <DataTemplate.Resources>
                        <local:GraphTemplateSelector x:Key="GraphTemplateSelector" />
                        <DataTemplate x:Key="Graph.Line">
                            <TextBlock Text="Line graph type (not implemented yet)." />
                        </DataTemplate>
                        <DataTemplate x:Key="Graph.Surface">
                            <TextBlock Text="Surface graph type (not implemented yet)." />
                        </DataTemplate>
                        <DataTemplate x:Key="Graph.Polar">
                            <TextBlock Text="Polar graph type (not implemented yet)." />
                        </DataTemplate>
                        <DataTemplate x:Key="Graph.Table"
                                      DataType="{x:Type idi:MeasurementGraph}">
                            <DataTemplate.Resources>
                                <graph:MeasurementGraphToTableGraphViewModelConverter x:Key="MeasurementGraphToTableGraphViewModelConverter" />
                            </DataTemplate.Resources>
                            <Grid DataContext="{Binding Converter={StaticResource MeasurementGraphToTableGraphViewModelConverter}}">
                                <StackPanel DataContext="{Binding Path=Data}">
                                    <DataGrid Margin="40 2 20 2"
                                              HorizontalAlignment="Stretch"
                                              ItemsSource="{Binding}"
                                              AutoGeneratingColumn="DataGrid_OnAutoGeneratingColumn"
                                              HeadersVisibility="Column"
                                              IsReadOnly="True"
                                              IsHitTestVisible="False" />
                                </StackPanel>
                            </Grid>
                        </DataTemplate>
                        <DataTemplate x:Key="Graph.Bar">
                            <TextBlock Text="Bar graph type (not implemented yet)." />
                        </DataTemplate>
                        <DataTemplate x:Key="Graph.Unknown">
                            <TextBlock Text="Unknown graph data type" />
                        </DataTemplate>
                    </DataTemplate.Resources>
                    <Grid ClipToBounds="True"
                          Margin="0 0 0 0">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="auto" />
                            <RowDefinition Height="auto" />
                        </Grid.RowDefinitions>
                        <Grid HorizontalAlignment="Left">
                            <ToggleButton x:Name="ExpandToggleButton"
                                          Style="{StaticResource ToggleButton.TreeNode}"
                                          Tag="True">
                                <ToggleButton.Content>
                                    <StackPanel Orientation="Horizontal">
                                        <ContentControl Style="{StaticResource MeasurementGraph.Image}" />
                                        <TextBlock Text="{Binding Path=Info, Converter={StaticResource InfoToTextConverter}}"
                                                   VerticalAlignment="Center"
                                                   Style="{StaticResource TextBlock.Content}" />
                                    </StackPanel>
                                </ToggleButton.Content>
                            </ToggleButton>
                        </Grid>
                        <Rectangle x:Name="Placeholder"
                                   Grid.Row="1"
                                   Style="{StaticResource Placeholder.ScaleY}"
                                   Height="{Binding ElementName=GraphGrid, Path=ActualHeight, Mode=OneWay}"
                                   Tag="{Binding ElementName=ExpandToggleButton, Path=IsChecked, Mode=OneWay}" />
                        <Canvas Grid.Row="1">
                            <Grid x:Name="GraphGrid"
                                  Width="{Binding ElementName=Placeholder, Path=ActualWidth, Mode=OneWay}">
                                <controls:BurnInContent>
                                    <controls:BurnInContent.Style>
                                        <Style TargetType="{x:Type controls:BurnInContent}">
                                            <Style.Triggers>
                                                <!--Show only when needed-->
                                                <DataTrigger Binding="{Binding ElementName=ExpandToggleButton, Path=IsChecked}"
                                                             Value="True">
                                                    <Setter Property="Content">
                                                        <Setter.Value>
                                                            <ContentControl Content="{Binding}"
                                                                            ContentTemplateSelector="{StaticResource GraphTemplateSelector}" />
                                                        </Setter.Value>
                                                    </Setter>
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </controls:BurnInContent.Style>
                                </controls:BurnInContent>
                            </Grid>
                        </Canvas>
                    </Grid>
                </DataTemplate>
            </DataTemplate.Resources>
            <Grid ClipToBounds="True"
                  DataContext="{Binding Converter={StaticResource MeasurementToViewModelConverter}}">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid HorizontalAlignment="Left">
                    <StackPanel Orientation="Horizontal">
                        <ToggleButton x:Name="ExpandButton"
                                      Style="{StaticResource ToggleButton.TreeNode}"
                                      Height="Auto"
                                      MinHeight="25"
                                      ToolTip="{Binding Path=Model.Info, Converter={StaticResource InfoToTextConverter}}"
                                      Foreground="{StaticResource Brush.Separator.Strong}"
                                      IsChecked="{Binding Path=IsExpanded, Mode=OneWay}"
                                      Tag="True">
                            <ToggleButton.Content>
                                <StackPanel Orientation="Vertical">
                                    <StackPanel Orientation="Horizontal"
                                                Margin="6 0">
                                        <ContentControl x:Name="Image"
                                                        Content="{Binding}">
                                            <ContentControl.ContentTemplate>
                                                <DataTemplate>
                                                    <Ellipse Width="8"
                                                             Height="8">
                                                        <Ellipse.Style>
                                                            <Style TargetType="Ellipse">
                                                                <Setter Property="Fill"
                                                                        Value="{StaticResource Brush.White}" />
                                                                <Setter Property="Stroke"
                                                                        Value="{StaticResource Brush.Separator}" />
                                                                <Setter Property="StrokeThickness"
                                                                        Value="1" />
                                                                <Style.Triggers>
                                                                    <DataTrigger Binding="{Binding Path=Model.Status}"
                                                                                 Value="{x:Static ddr:GeneralStatus.Pass}">
                                                                        <Setter Property="Fill"
                                                                                Value="{StaticResource Brush.Marker.Confirm}" />
                                                                        <Setter Property="StrokeThickness"
                                                                                Value="0" />
                                                                    </DataTrigger>
                                                                    <DataTrigger Binding="{Binding Path=Model.Status}"
                                                                                 Value="{x:Static ddr:GeneralStatus.Fail}">
                                                                        <Setter Property="Fill"
                                                                                Value="{StaticResource Brush.Marker.Reject}" />
                                                                        <Setter Property="StrokeThickness"
                                                                                Value="0" />
                                                                    </DataTrigger>
                                                                </Style.Triggers>
                                                            </Style>
                                                        </Ellipse.Style>
                                                    </Ellipse>
                                                </DataTemplate>
                                            </ContentControl.ContentTemplate>
                                        </ContentControl>
                                        <TextBlock Text="{Binding Path=Model.Info, Mode=OneWay, Converter={StaticResource InfoToTextConverter}}"
                                                   Style="{StaticResource TextBlock.Content}"
                                                   Margin="5 0" />
                                    </StackPanel>
                                    <TextBlock Style="{StaticResource TextBlock.Comment}"
                                               ToolTip="{Binding Path=Model.Comment}"
                                               MaxWidth="300"
                                               Margin="19 0 20 2"
                                               Text="{Binding Path=Model.Comment, Mode=OneWay}" />
                                </StackPanel>
                            </ToggleButton.Content>
                        </ToggleButton>
                        <Viewbox Stretch="Uniform"
                                 Margin="3 0"
                                 Width="7"
                                 Visibility="{Binding Path=IsLocked, Converter={StaticResource BooleanToVisibilityConverter}}">
                            <Path Data="{StaticResource Geometry.Lock}"
                                  Fill="{StaticResource Brush.Foreground}" />
                        </Viewbox>
                    </StackPanel>
                </Grid>
                <Rectangle x:Name="Placeholder"
                           Grid.Row="1"
                           Style="{StaticResource Placeholder.ScaleY}"
                           Height="{Binding ElementName=ChildrenGrid, Path=ActualHeight, Mode=OneWay}"
                           Tag="{Binding ElementName=ExpandButton, Path=IsChecked, Mode=OneWay}" />
                <Canvas Grid.Row="1">
                    <Grid x:Name="ChildrenGrid"
                          Width="{Binding ElementName=Placeholder, Path=ActualWidth, Mode=OneWay}">
                        <controls:BurnInContent>
                            <controls:BurnInContent.Style>
                                <Style TargetType="{x:Type controls:BurnInContent}">
                                    <Style.Triggers>
                                        <!-- load content only when needed -->
                                        <DataTrigger Binding="{Binding ElementName=ExpandButton, Path=IsChecked}"
                                                     Value="True">
                                            <Setter Property="Content">
                                                <Setter.Value>
                                                    <ContentControl Content="{Binding}">
                                                        <ContentControl.ContentTemplate>
                                                            <DataTemplate>
                                                                <StackPanel Orientation="Vertical"
                                                                            Grid.IsSharedSizeScope="True">
                                                                    <Grid x:Name="Results"
                                                                          ClipToBounds="True"
                                                                          Margin="20 0 0 0"
                                                                          Visibility="{Binding Path=Model.HasResults, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}">
                                                                        <Grid.RowDefinitions>
                                                                            <RowDefinition Height="auto" />
                                                                            <RowDefinition Height="auto" />
                                                                        </Grid.RowDefinitions>
                                                                        <Grid.ColumnDefinitions>
                                                                            <ColumnDefinition Width="Auto"
                                                                                              SharedSizeGroup="Result.Name" />
                                                                            <ColumnDefinition Width="Auto"
                                                                                              SharedSizeGroup="Result.Value" />
                                                                        </Grid.ColumnDefinitions>
                                                                        <Grid HorizontalAlignment="Left">
                                                                            <ToggleButton x:Name="ExpandResultsToggleButton"
                                                                                          Style="{StaticResource ToggleButton.TreeNode}"
                                                                                          Tag="{Binding Path=Model.HasResults, Mode=OneWay}">
                                                                                <ToggleButton.Content>
                                                                                    <StackPanel Orientation="Horizontal">
                                                                                        <ContentControl Style="{StaticResource MeasurementResult.Image}" />
                                                                                        <TextBlock Text="Results"
                                                                                                   VerticalAlignment="Center"
                                                                                                   Style="{StaticResource TextBlock.Content}" />
                                                                                    </StackPanel>
                                                                                </ToggleButton.Content>
                                                                            </ToggleButton>
                                                                        </Grid>
                                                                        <Rectangle x:Name="ResultsPlaceholder"
                                                                                   Grid.Row="1"
                                                                                   Style="{StaticResource Placeholder.ScaleY}"
                                                                                   Height="{Binding ElementName=ResultsGrid, Path=ActualHeight, Mode=OneWay}"
                                                                                   Tag="{Binding ElementName=ExpandResultsToggleButton, Path=IsChecked, Mode=OneWay}" />
                                                                        <Canvas Grid.Row="1">
                                                                            <Grid x:Name="ResultsGrid"
                                                                                  Width="{Binding ElementName=Placeholder, Path=ActualWidth, Mode=OneWay}">
                                                                                <ItemsControl ItemsSource="{Binding Path=Model.Results}"
                                                                                              Margin="40 0 0 0" />
                                                                            </Grid>
                                                                        </Canvas>
                                                                    </Grid>
                                                                    <Grid x:Name="Parameters"
                                                                          ClipToBounds="True"
                                                                          Margin="20 0 0 0"
                                                                          Visibility="{Binding Path=Model.HasParameters, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}">
                                                                        <Grid.RowDefinitions>
                                                                            <RowDefinition Height="auto" />
                                                                            <RowDefinition Height="auto" />
                                                                        </Grid.RowDefinitions>
                                                                        <Grid.ColumnDefinitions>
                                                                            <ColumnDefinition Width="Auto"
                                                                                              SharedSizeGroup="Parameter.Name" />
                                                                            <ColumnDefinition Width="Auto"
                                                                                              SharedSizeGroup="Parameter.Value" />
                                                                        </Grid.ColumnDefinitions>
                                                                        <Grid HorizontalAlignment="Left">
                                                                            <ToggleButton x:Name="ExpandParametersToggleButton"
                                                                                          Style="{StaticResource ToggleButton.TreeNode}"
                                                                                          Tag="{Binding Path=Model.HasParameters, Mode=OneWay}">
                                                                                <ToggleButton.Content>
                                                                                    <StackPanel Orientation="Horizontal">
                                                                                        <ContentControl Style="{StaticResource MeasurementParameter.Image}" />
                                                                                        <TextBlock Text="Parameters"
                                                                                                   VerticalAlignment="Center"
                                                                                                   Style="{StaticResource TextBlock.Content}" />
                                                                                    </StackPanel>
                                                                                </ToggleButton.Content>
                                                                            </ToggleButton>
                                                                        </Grid>
                                                                        <Rectangle x:Name="ParametersPlaceholder"
                                                                                   Grid.Row="1"
                                                                                   Style="{StaticResource Placeholder.ScaleY}"
                                                                                   Height="{Binding ElementName=ParametersGrid, Path=ActualHeight, Mode=OneWay}"
                                                                                   Tag="{Binding ElementName=ExpandParametersToggleButton, Path=IsChecked, Mode=OneWay}" />
                                                                        <Canvas Grid.Row="1">
                                                                            <Grid x:Name="ParametersGrid"
                                                                                  Width="{Binding ElementName=Placeholder, Path=ActualWidth, Mode=OneWay}">
                                                                                <ItemsControl ItemsSource="{Binding Path=Model.Parameters}"
                                                                                              Margin="40 0 0 0" />
                                                                            </Grid>
                                                                        </Canvas>
                                                                    </Grid>
                                                                    <Grid x:Name="Limits"
                                                                          ClipToBounds="True"
                                                                          Margin="20 0 0 0"
                                                                          Visibility="{Binding Path=Model.HasLimits, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}">
                                                                        <Grid.RowDefinitions>
                                                                            <RowDefinition Height="auto" />
                                                                            <RowDefinition Height="auto" />
                                                                        </Grid.RowDefinitions>
                                                                        <Grid.ColumnDefinitions>
                                                                            <ColumnDefinition Width="Auto"
                                                                                              SharedSizeGroup="Limit.Name" />
                                                                            <ColumnDefinition Width="Auto"
                                                                                              SharedSizeGroup="Limit.Value" />
                                                                        </Grid.ColumnDefinitions>
                                                                        <Grid HorizontalAlignment="Left">
                                                                            <ToggleButton x:Name="ExpandLimitsToggleButton"
                                                                                          Style="{StaticResource ToggleButton.TreeNode}"
                                                                                          Tag="{Binding Path=HasLimits, Mode=OneWay}">
                                                                                <ToggleButton.Content>
                                                                                    <StackPanel Orientation="Horizontal">
                                                                                        <ContentControl Style="{StaticResource MeasurementResultLimit.Image}" />
                                                                                        <TextBlock Text="Limits"
                                                                                                   VerticalAlignment="Center"
                                                                                                   Style="{StaticResource TextBlock.Content}" />
                                                                                    </StackPanel>
                                                                                </ToggleButton.Content>
                                                                            </ToggleButton>
                                                                        </Grid>
                                                                        <Rectangle x:Name="LimitsPlaceholder"
                                                                                   Grid.Row="1"
                                                                                   Style="{StaticResource Placeholder.ScaleY}"
                                                                                   Height="{Binding ElementName=LimitsGrid, Path=ActualHeight, Mode=OneWay}"
                                                                                   Tag="{Binding ElementName=ExpandLimitsToggleButton, Path=IsChecked, Mode=OneWay}" />
                                                                        <Canvas Grid.Row="1">
                                                                            <Grid x:Name="LimitsGrid"
                                                                                  Width="{Binding ElementName=Placeholder, Path=ActualWidth, Mode=OneWay}">
                                                                                <ItemsControl ItemsSource="{Binding Path=Model.Limits}"
                                                                                              Margin="40 0 0 0" />
                                                                            </Grid>
                                                                        </Canvas>
                                                                    </Grid>
                                                                    <Grid x:Name="Graphs"
                                                                          ClipToBounds="True"
                                                                          Margin="20 0 0 0"
                                                                          Visibility="{Binding Path=Model.HasGraphs, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}">
                                                                        <Grid.RowDefinitions>
                                                                            <RowDefinition Height="auto" />
                                                                            <RowDefinition Height="auto" />
                                                                        </Grid.RowDefinitions>
                                                                        <Grid.ColumnDefinitions>
                                                                            <ColumnDefinition Width="Auto"
                                                                                              SharedSizeGroup="Graph.Name" />
                                                                            <ColumnDefinition Width="Auto"
                                                                                              SharedSizeGroup="Graph.Value" />
                                                                        </Grid.ColumnDefinitions>
                                                                        <Grid HorizontalAlignment="Left">
                                                                            <ToggleButton x:Name="ExpandGraphsToggleButton"
                                                                                          Style="{StaticResource ToggleButton.TreeNode}"
                                                                                          Tag="{Binding Path=Model.HasGraphs, Mode=OneWay}">
                                                                                <ToggleButton.Content>
                                                                                    <StackPanel Orientation="Horizontal">
                                                                                        <ContentControl Style="{StaticResource MeasurementGraph.Image}" />
                                                                                        <TextBlock Text="Graphs"
                                                                                                   VerticalAlignment="Center"
                                                                                                   Style="{StaticResource TextBlock.Content}" />
                                                                                    </StackPanel>
                                                                                </ToggleButton.Content>
                                                                            </ToggleButton>
                                                                        </Grid>
                                                                        <Rectangle x:Name="GraphsPlaceholder"
                                                                                   Grid.Row="1"
                                                                                   Style="{StaticResource Placeholder.ScaleY}"
                                                                                   Height="{Binding ElementName=GraphsGrid, Path=ActualHeight, Mode=OneWay}"
                                                                                   Tag="{Binding ElementName=ExpandGraphsToggleButton, Path=IsChecked, Mode=OneWay}" />
                                                                        <Canvas Grid.Row="1">
                                                                            <Grid x:Name="GraphsGrid"
                                                                                  Width="{Binding ElementName=Placeholder, Path=ActualWidth, Mode=OneWay}">
                                                                                <ItemsControl ItemsSource="{Binding Path=Model.Graphs}"
                                                                                              Margin="20 0 0 0" />
                                                                            </Grid>
                                                                        </Canvas>
                                                                    </Grid>
                                                                    <Grid ClipToBounds="True"
                                                                          Visibility="{Binding Path=Model.Instrument, Converter={StaticResource NotNullToVisibilityConverter}}"
                                                                          Margin="20 0 0 0">
                                                                        <Grid.RowDefinitions>
                                                                            <RowDefinition Height="auto" />
                                                                            <RowDefinition Height="auto" />
                                                                        </Grid.RowDefinitions>
                                                                        <Grid HorizontalAlignment="Left">
                                                                            <ToggleButton x:Name="ExpandInstrumentsButton"
                                                                                          Height="Auto"
                                                                                          MinHeight="25"
                                                                                          Style="{StaticResource ToggleButton.TreeNode}"
                                                                                          Tag="True"
                                                                                          Foreground="{StaticResource Brush.Separator.Strong}">
                                                                                <ToggleButton.Content>
                                                                                    <StackPanel Orientation="Horizontal">
                                                                                        <ContentControl Margin="5 0 0 0">
                                                                                            <ContentControl.ContentTemplate>
                                                                                                <DataTemplate>
                                                                                                    <Viewbox Stretch="Uniform"
                                                                                                             HorizontalAlignment="Center"
                                                                                                             VerticalAlignment="Center"
                                                                                                             Margin="2 0 0 0"
                                                                                                             Height="10">
                                                                                                        <Path Stretch="Uniform"
                                                                                                              Fill="{StaticResource Brush.Instrument}"
                                                                                                              Data="{StaticResource Geometry.Instrument}" />
                                                                                                    </Viewbox>
                                                                                                </DataTemplate>
                                                                                            </ContentControl.ContentTemplate>
                                                                                        </ContentControl>
                                                                                        <TextBlock Text="Instruments"
                                                                                                   Style="{StaticResource TextBlock.Content}"
                                                                                                   Margin="5 0" />
                                                                                    </StackPanel>
                                                                                </ToggleButton.Content>
                                                                            </ToggleButton>
                                                                        </Grid>
                                                                        <Rectangle x:Name="InstrumentsPlaceholder"
                                                                                   Grid.Row="1"
                                                                                   Style="{StaticResource Placeholder.ScaleY}"
                                                                                   Height="{Binding ElementName=InstrumentsGrid, Path=ActualHeight, Mode=OneWay}"
                                                                                   Tag="{Binding ElementName=ExpandInstrumentsButton, Path=IsChecked, Mode=OneWay}" />
                                                                        <Canvas Grid.Row="1">
                                                                            <Grid x:Name="InstrumentsGrid"
                                                                                  Width="{Binding ElementName=InstrumentsPlaceholder, Path=ActualWidth, Mode=OneWay}">
                                                                                <controls:BurnInContent>
                                                                                    <controls:BurnInContent.Style>
                                                                                        <Style TargetType="{x:Type controls:BurnInContent}">
                                                                                            <Style.Triggers>
                                                                                                <!-- load content only when needed -->
                                                                                                <DataTrigger Binding="{Binding ElementName=ExpandInstrumentsButton, Path=IsChecked}"
                                                                                                             Value="True">
                                                                                                    <Setter Property="Content">
                                                                                                        <Setter.Value>
                                                                                                            <StackPanel Grid.IsSharedSizeScope="True"
                                                                                                                        Margin="40 0 0 0">
                                                                                                                <Grid x:Name="InstrumentListHeadersGrid">
                                                                                                                    <Grid.Resources>
                                                                                                                        <Style TargetType="TextBlock"
                                                                                                                               BasedOn="{StaticResource TextBlock.Content}">
                                                                                                                            <Setter Property="Foreground"
                                                                                                                                    Value="{StaticResource Brush.Accent.Strong}" />
                                                                                                                            <Setter Property="Margin"
                                                                                                                                    Value="{StaticResource Margin.Text}" />
                                                                                                                        </Style>
                                                                                                                        <Style TargetType="Border">
                                                                                                                            <Setter Property="BorderBrush"
                                                                                                                                    Value="{StaticResource Brush.Separator}" />
                                                                                                                            <Setter Property="BorderThickness"
                                                                                                                                    Value="0 0 1 0" />
                                                                                                                            <Setter Property="Opacity"
                                                                                                                                    Value="0.2" />
                                                                                                                        </Style>
                                                                                                                    </Grid.Resources>
                                                                                                                    <Grid.ColumnDefinitions>
                                                                                                                        <ColumnDefinition Width="Auto"
                                                                                                                                          SharedSizeGroup="Instrument_MetrelInstrumentName" />
                                                                                                                        <ColumnDefinition Width="Auto"
                                                                                                                                          SharedSizeGroup="Instrument_Guid" />
                                                                                                                        <ColumnDefinition Width="Auto"
                                                                                                                                          SharedSizeGroup="Instrument_HardwareVersion" />
                                                                                                                        <ColumnDefinition Width="Auto"
                                                                                                                                          SharedSizeGroup="Instrument_SoftwareVersion" />
                                                                                                                    </Grid.ColumnDefinitions>
                                                                                                                    <Border Grid.ColumnSpan="4"
                                                                                                                            Background="{StaticResource Brush.Background.Strong}"
                                                                                                                            BorderThickness="0 0 0 1" />
                                                                                                                    <Border Grid.Column="0" />
                                                                                                                    <TextBlock Grid.Column="0"
                                                                                                                               Text="Name" />
                                                                                                                    <Border Grid.Column="1" />
                                                                                                                    <TextBlock Grid.Column="1"
                                                                                                                               Text="Id" />
                                                                                                                    <Border Grid.Column="2" />
                                                                                                                    <TextBlock Grid.Column="2"
                                                                                                                               Text="HW Version" />
                                                                                                                    <TextBlock Grid.Column="3"
                                                                                                                               Text="SW Version" />
                                                                                                                </Grid>
                                                                                                                <ContentControl Content="{Binding Path=Model.Instrument}" />
                                                                                                            </StackPanel>
                                                                                                        </Setter.Value>
                                                                                                    </Setter>
                                                                                                </DataTrigger>
                                                                                            </Style.Triggers>
                                                                                        </Style>
                                                                                    </controls:BurnInContent.Style>
                                                                                </controls:BurnInContent>
                                                                            </Grid>
                                                                        </Canvas>
                                                                    </Grid>
                                                                    <Grid ClipToBounds="True"
                                                                          Visibility="{Binding Path=Model.User, Converter={StaticResource NotNullToVisibilityConverter}}"
                                                                          Margin="20 0 0 0">
                                                                        <Grid.RowDefinitions>
                                                                            <RowDefinition Height="auto" />
                                                                            <RowDefinition Height="auto" />
                                                                        </Grid.RowDefinitions>
                                                                        <Grid HorizontalAlignment="Left">
                                                                            <ToggleButton x:Name="ExpandUsersButton"
                                                                                          Height="Auto"
                                                                                          MinHeight="25"
                                                                                          Style="{StaticResource ToggleButton.TreeNode}"
                                                                                          Tag="True"
                                                                                          Foreground="{StaticResource Brush.Separator.Strong}">
                                                                                <ToggleButton.Content>
                                                                                    <StackPanel Orientation="Horizontal">
                                                                                        <ContentControl Margin="5 0 0 0">
                                                                                            <ContentControl.ContentTemplate>
                                                                                                <DataTemplate>
                                                                                                    <Viewbox Stretch="Uniform"
                                                                                                             HorizontalAlignment="Center"
                                                                                                             VerticalAlignment="Center"
                                                                                                             Margin="2 0 0 0"
                                                                                                             Height="10">
                                                                                                        <Path Stretch="Uniform"
                                                                                                              Fill="{StaticResource Brush.User}"
                                                                                                              Data="{StaticResource Geometry.User}" />
                                                                                                    </Viewbox>
                                                                                                </DataTemplate>
                                                                                            </ContentControl.ContentTemplate>
                                                                                        </ContentControl>
                                                                                        <TextBlock Text="Users"
                                                                                                   Style="{StaticResource TextBlock.Content}"
                                                                                                   Margin="5 0" />
                                                                                    </StackPanel>
                                                                                </ToggleButton.Content>
                                                                            </ToggleButton>
                                                                        </Grid>
                                                                        <Rectangle x:Name="UsersPlaceholder"
                                                                                   Grid.Row="1"
                                                                                   Style="{StaticResource Placeholder.ScaleY}"
                                                                                   Height="{Binding ElementName=UsersGrid, Path=ActualHeight, Mode=OneWay}"
                                                                                   Tag="{Binding ElementName=ExpandUsersButton, Path=IsChecked, Mode=OneWay}" />
                                                                        <Canvas Grid.Row="1">
                                                                            <Grid x:Name="UsersGrid"
                                                                                  Width="{Binding ElementName=UsersPlaceholder, Path=ActualWidth, Mode=OneWay}">
                                                                                <controls:BurnInContent>
                                                                                    <controls:BurnInContent.Style>
                                                                                        <Style TargetType="{x:Type controls:BurnInContent}">
                                                                                            <Style.Triggers>
                                                                                                <!-- load content only when needed -->
                                                                                                <DataTrigger Binding="{Binding ElementName=ExpandUsersButton, Path=IsChecked}"
                                                                                                             Value="True">
                                                                                                    <Setter Property="Content">
                                                                                                        <Setter.Value>
                                                                                                            <StackPanel Grid.IsSharedSizeScope="True"
                                                                                                                        Margin="40 0 0 0">
                                                                                                                <Grid x:Name="UsersListHeadersGrid">
                                                                                                                    <Grid.Resources>
                                                                                                                        <Style TargetType="TextBlock"
                                                                                                                               BasedOn="{StaticResource TextBlock.Content}">
                                                                                                                            <Setter Property="Foreground"
                                                                                                                                    Value="{StaticResource Brush.Accent.Strong}" />
                                                                                                                            <Setter Property="Margin"
                                                                                                                                    Value="{StaticResource Margin.Text}" />
                                                                                                                        </Style>
                                                                                                                        <Style TargetType="Border">
                                                                                                                            <Setter Property="BorderBrush"
                                                                                                                                    Value="{StaticResource Brush.Separator}" />
                                                                                                                            <Setter Property="BorderThickness"
                                                                                                                                    Value="0 0 1 0" />
                                                                                                                            <Setter Property="Opacity"
                                                                                                                                    Value="0.2" />
                                                                                                                        </Style>
                                                                                                                    </Grid.Resources>
                                                                                                                    <Grid.ColumnDefinitions>
                                                                                                                        <ColumnDefinition Width="Auto"
                                                                                                                                          SharedSizeGroup="User_Name" />
                                                                                                                        <ColumnDefinition Width="Auto"
                                                                                                                                          SharedSizeGroup="User_Guid" />
                                                                                                                    </Grid.ColumnDefinitions>
                                                                                                                    <Border Grid.ColumnSpan="4"
                                                                                                                            Background="{StaticResource Brush.Background.Strong}"
                                                                                                                            BorderThickness="0 0 0 1" />
                                                                                                                    <Border Grid.Column="0" />
                                                                                                                    <TextBlock Grid.Column="0"
                                                                                                                               Text="Name" />
                                                                                                                    <TextBlock Grid.Column="1"
                                                                                                                               Text="Id" />
                                                                                                                </Grid>
                                                                                                                <ContentControl Content="{Binding Path=Model.User}" />
                                                                                                            </StackPanel>
                                                                                                        </Setter.Value>
                                                                                                    </Setter>
                                                                                                </DataTrigger>
                                                                                            </Style.Triggers>
                                                                                        </Style>
                                                                                    </controls:BurnInContent.Style>
                                                                                </controls:BurnInContent>
                                                                            </Grid>
                                                                        </Canvas>
                                                                    </Grid>
                                                                </StackPanel>
                                                            </DataTemplate>
                                                        </ContentControl.ContentTemplate>
                                                    </ContentControl>
                                                </Setter.Value>
                                            </Setter>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </controls:BurnInContent.Style>
                        </controls:BurnInContent>
                    </Grid>
                </Canvas>
            </Grid>
        </DataTemplate>
        <DataTemplate DataType="{x:Type idi:SingleTest}">
            <ContentPresenter x:Name="MeasurementPresenter"
                              Content="{Binding  Path=Measurement}" />
        </DataTemplate>
        <DataTemplate DataType="{x:Type idi:AutoSequence}">
            <Grid ClipToBounds="True">
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="auto" />
                </Grid.RowDefinitions>
                <Grid HorizontalAlignment="Left">
                    <StackPanel Orientation="Horizontal">
                        <ToggleButton x:Name="ExpandButton"
                                      Height="Auto"
                                      MinHeight="25"
                                      Style="{StaticResource ToggleButton.TreeNode}"
                                      ToolTip="{Binding Path=Header.Name}"
                                      Tag="{Binding Converter={StaticResource StructureObjectHasChildrenToBooleanConverter}}"
                                      Foreground="{StaticResource Brush.Separator.Strong}">
                            <ToggleButton.Content>
                                <StackPanel Orientation="Vertical">
                                    <StackPanel Orientation="Horizontal">
                                        <ContentControl x:Name="Image"
                                                        Margin="5 0 0 0">
                                            <ContentControl.ContentTemplate>
                                                <DataTemplate>
                                                    <Border Background="#22CCFF"
                                                            Width="15"
                                                            Height="10"
                                                            CornerRadius="3">
                                                        <Viewbox Stretch="Uniform"
                                                                 HorizontalAlignment="Center"
                                                                 VerticalAlignment="Center"
                                                                 Margin="2 0 0 0"
                                                                 Height="6">
                                                            <Path Stretch="Uniform"
                                                                  Fill="{StaticResource Brush.White}"
                                                                  Data="{StaticResource Geometry.AutoSequence}" />
                                                        </Viewbox>
                                                    </Border>
                                                </DataTemplate>
                                            </ContentControl.ContentTemplate>
                                        </ContentControl>
                                        <TextBlock Text="{Binding Path=Header.Name, Mode=OneWay}"
                                                   Style="{StaticResource TextBlock.Content}"
                                                   Margin="5 0" />
                                    </StackPanel>
                                    <TextBlock Style="{StaticResource TextBlock.Comment}"
                                               ToolTip="{Binding Path=Comment}"
                                               MaxWidth="300"
                                               Margin="25 0 20 2"
                                               Text="{Binding Path=Comment, Mode=OneWay}" />
                                </StackPanel>
                            </ToggleButton.Content>
                        </ToggleButton>
                    </StackPanel>
                </Grid>
                <Rectangle x:Name="Placeholder"
                           Grid.Row="1"
                           Style="{StaticResource Placeholder.ScaleY}"
                           Height="{Binding ElementName=ChildrenGrid, Path=ActualHeight, Mode=OneWay}"
                           Tag="{Binding ElementName=ExpandButton, Path=IsChecked, Mode=OneWay}" />
                <Canvas Grid.Row="1">
                    <Grid x:Name="ChildrenGrid"
                          Width="{Binding ElementName=Placeholder, Path=ActualWidth, Mode=OneWay}">
                        <controls:BurnInContent>
                            <controls:BurnInContent.Style>
                                <Style TargetType="{x:Type controls:BurnInContent}">
                                    <Style.Triggers>
                                        <!-- load content only when needed -->
                                        <DataTrigger Binding="{Binding ElementName=ExpandButton, Path=IsChecked}"
                                                     Value="True">
                                            <Setter Property="Content">
                                                <Setter.Value>
                                                    <ContentControl Content="{Binding}">
                                                        <ContentControl.ContentTemplate>
                                                            <DataTemplate>
                                                                <StackPanel Orientation="Vertical">
                                                                    <ItemsControl ItemsSource="{Binding Path=Tests, Converter={StaticResource IEnumerableToTestListConverter}}"
                                                                                  Margin="20 0 0 0" />
                                                                </StackPanel>
                                                            </DataTemplate>
                                                        </ContentControl.ContentTemplate>
                                                    </ContentControl>
                                                </Setter.Value>
                                            </Setter>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </controls:BurnInContent.Style>
                        </controls:BurnInContent>
                    </Grid>
                </Canvas>
            </Grid>
        </DataTemplate>
        <DataTemplate DataType="{x:Type idi:PredefinedInspection}">
            <Grid ClipToBounds="True">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <StackPanel Orientation="Horizontal"
                            DataContext="{Binding Converter={StaticResource InspectionViewModelConverter}}">
                    <ToggleButton x:Name="ExpandButton"
                                  IsChecked="{Binding Path=IsExpanded, Mode=TwoWay}"
                                  Height="Auto"
                                  MinHeight="25"
                                  Style="{StaticResource ToggleButton.TreeNode}"
                                  ToolTip="{Binding Path=Model.Info, Converter={StaticResource InfoToTextConverter}}"
                                  Foreground="{StaticResource Brush.Separator.Strong}"
                                  Tag="{Binding Path=HasChildren}">
                        <ToggleButton.Content>
                            <StackPanel Orientation="Vertical">
                                <StackPanel Orientation="Horizontal"
                                            Margin="6 0">
                                    <ContentControl x:Name="Image"
                                                    Content="{Binding}">
                                        <ContentControl.ContentTemplate>
                                            <DataTemplate>
                                                <Ellipse Width="8"
                                                         Height="8">
                                                    <Ellipse.Style>
                                                        <Style TargetType="Ellipse">
                                                            <Setter Property="Fill"
                                                                    Value="{StaticResource Brush.White}" />
                                                            <Setter Property="Stroke"
                                                                    Value="{StaticResource Brush.Separator}" />
                                                            <Setter Property="StrokeThickness"
                                                                    Value="1" />
                                                            <Style.Triggers>
                                                                <DataTrigger Binding="{Binding Path=Model.Status}"
                                                                             Value="{x:Static ddr:GeneralStatus.Pass}">
                                                                    <Setter Property="Fill"
                                                                            Value="{StaticResource Brush.Marker.Confirm}" />
                                                                    <Setter Property="StrokeThickness"
                                                                            Value="0" />
                                                                </DataTrigger>
                                                                <DataTrigger Binding="{Binding Path=Model.Status}"
                                                                             Value="{x:Static ddr:GeneralStatus.Fail}">
                                                                    <Setter Property="Fill"
                                                                            Value="{StaticResource Brush.Marker.Reject}" />
                                                                    <Setter Property="StrokeThickness"
                                                                            Value="0" />
                                                                </DataTrigger>
                                                            </Style.Triggers>
                                                        </Style>
                                                    </Ellipse.Style>
                                                </Ellipse>
                                            </DataTemplate>
                                        </ContentControl.ContentTemplate>
                                    </ContentControl>
                                    <TextBlock Text="{Binding Path=Model.Info, Mode=OneWay, Converter={StaticResource InfoToTextConverter}}"
                                               Style="{StaticResource TextBlock.Content}"
                                               Margin="5 0" />
                                </StackPanel>
                                <TextBlock Style="{StaticResource TextBlock.Comment}"
                                           ToolTip="{Binding Path=Model.Comment}"
                                           MaxWidth="300"
                                           Margin="20 0 20 2"
                                           Text="{Binding Path=Model.Comment, Mode=OneWay}" />
                            </StackPanel>
                        </ToggleButton.Content>
                    </ToggleButton>
                    <Viewbox Stretch="Uniform"
                             Margin="3 0"
                             Width="7"
                             Visibility="{Binding Path=IsLocked, Converter={StaticResource BooleanToVisibilityConverter}}">
                        <Path Data="{StaticResource Geometry.Lock}"
                              Fill="{StaticResource Brush.Foreground}" />
                    </Viewbox>
                </StackPanel>
                <Rectangle x:Name="Placeholder"
                           Grid.Row="1"
                           Style="{StaticResource Placeholder.ScaleY}"
                           Height="{Binding ElementName=ChildrenGrid, Path=ActualHeight, Mode=OneWay}"
                           Tag="{Binding ElementName=ExpandButton, Path=IsChecked, Mode=OneWay}" />
                <Canvas Grid.Row="1"
                        Width="{Binding ElementName=Placeholder, Path=ActualWidth}">
                    <Grid x:Name="ChildrenGrid"
                          Width="{Binding ElementName=Placeholder, Path=ActualWidth, Mode=OneWay}">
                        <ItemsControl ItemsSource="{Binding Path=Children}"
                                      Margin="20 0 0 0" />
                    </Grid>
                </Canvas>
            </Grid>
        </DataTemplate>
        <DataTemplate DataType="{x:Type idi:CustomInspection}">
            <Grid ClipToBounds="True">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <StackPanel Orientation="Horizontal"
                            DataContext="{Binding Converter={StaticResource InspectionViewModelConverter}}">
                    <ToggleButton x:Name="ExpandButton"
                                  MinHeight="25"
                                  Height="Auto"
                                  IsChecked="{Binding Path=IsExpanded, Mode=TwoWay}"
                                  Style="{StaticResource ToggleButton.TreeNode}"
                                  ToolTip="{Binding Path=Model.Name}"
                                  Foreground="{StaticResource Brush.Separator.Strong}"
                                  Tag="{Binding Path=HasChildren}">
                        <ToggleButton.Content>
                            <StackPanel Orientation="Vertical">
                                <StackPanel Orientation="Horizontal"
                                            Margin="6 0">
                                    <ContentControl x:Name="Image"
                                                    Content="{Binding}">
                                        <ContentControl.ContentTemplate>
                                            <DataTemplate DataType="viewModels:CustomInspectionViewModel">
                                                <Ellipse Width="8"
                                                         Height="8">
                                                    <Ellipse.Style>
                                                        <Style TargetType="Ellipse">
                                                            <Setter Property="Fill"
                                                                    Value="{StaticResource Brush.White}" />
                                                            <Setter Property="Stroke"
                                                                    Value="{StaticResource Brush.Separator}" />
                                                            <Setter Property="StrokeThickness"
                                                                    Value="1" />
                                                            <Style.Triggers>
                                                                <DataTrigger Binding="{Binding Path=Model.Status}"
                                                                             Value="{x:Static ddr:GeneralStatus.Pass}">
                                                                    <Setter Property="Fill"
                                                                            Value="{StaticResource Brush.Marker.Confirm}" />
                                                                    <Setter Property="StrokeThickness"
                                                                            Value="0" />
                                                                </DataTrigger>
                                                                <DataTrigger Binding="{Binding Path=Model.Status}"
                                                                             Value="{x:Static ddr:GeneralStatus.Fail}">
                                                                    <Setter Property="Fill"
                                                                            Value="{StaticResource Brush.Marker.Reject}" />
                                                                    <Setter Property="StrokeThickness"
                                                                            Value="0" />
                                                                </DataTrigger>
                                                            </Style.Triggers>
                                                        </Style>
                                                    </Ellipse.Style>
                                                </Ellipse>
                                            </DataTemplate>
                                        </ContentControl.ContentTemplate>
                                    </ContentControl>
                                    <TextBlock Text="{Binding Path=Model.Name, Mode=OneWay}"
                                               Style="{StaticResource TextBlock.Content}"
                                               Margin="5 0" />
                                </StackPanel>
                                <TextBlock Style="{StaticResource TextBlock.Comment}"
                                           ToolTip="{Binding Path=Model.Comment}"
                                           MaxWidth="300"
                                           Margin="20 0 20 2"
                                           Text="{Binding Path=Model.Comment, Mode=OneWay}" />
                            </StackPanel>
                        </ToggleButton.Content>
                    </ToggleButton>
                    <Viewbox Stretch="Uniform"
                             Margin="3 0"
                             Width="7"
                             Visibility="{Binding Path=IsLocked, Converter={StaticResource BooleanToVisibilityConverter}}">
                        <Path Data="{StaticResource Geometry.Lock}"
                              Fill="{StaticResource Brush.Foreground}" />
                    </Viewbox>
                </StackPanel>
                <Rectangle x:Name="Placeholder"
                           Grid.Row="1"
                           Style="{StaticResource Placeholder.ScaleY}"
                           Height="{Binding ElementName=ChildrenGrid, Path=ActualHeight, Mode=OneWay}"
                           Tag="{Binding ElementName=ExpandButton, Path=IsChecked, Mode=OneWay}" />
                <Canvas Grid.Row="1"
                        Width="{Binding ElementName=Placeholder, Path=ActualWidth}">
                    <Grid x:Name="ChildrenGrid"
                          Width="{Binding ElementName=Placeholder, Path=ActualWidth, Mode=OneWay}">
                        <ItemsControl ItemsSource="{Binding Path=Children}"
                                      Margin="20 0 0 0" />
                    </Grid>
                </Canvas>
            </Grid>
        </DataTemplate>
        <DataTemplate DataType="{x:Type idi:StructureObject}">
            <DataTemplate.Resources>
                <Style x:Key="StructureObjectParameter.Image"
                       TargetType="ContentControl">
                    <Setter Property="Width"
                            Value="20" />
                    <Setter Property="Content"
                            Value="{Binding}" />
                    <Setter Property="ContentTemplate">
                        <Setter.Value>
                            <DataTemplate>
                                <Viewbox Stretch="Uniform"
                                         Width="8">
                                    <Path Stretch="Uniform"
                                          Fill="#BB7F58"
                                          Data="{StaticResource Geometry.StructureObjectParameter}" />
                                </Viewbox>
                            </DataTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
                <Style x:Key="StructureObject.Image"
                       TargetType="ContentControl">
                    <Setter Property="Width"
                            Value="20" />
                    <Setter Property="Content"
                            Value="{Binding}" />
                    <Setter Property="ContentTemplate">
                        <Setter.Value>
                            <DataTemplate>
                                <Viewbox Stretch="Uniform"
                                         Width="8">
                                    <Path Stretch="Uniform"
                                          Fill="#8877FE"
                                          Data="{StaticResource Geometry.StructureObject}" />
                                </Viewbox>
                            </DataTemplate>
                        </Setter.Value>
                    </Setter>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding Path=Model.BaseId}"
                                     Value="0">
                            <Setter Property="ContentTemplate">
                                <Setter.Value>
                                    <DataTemplate>
                                        <Viewbox Stretch="Uniform"
                                                 Width="8">
                                            <Path Stretch="Uniform"
                                                  Fill="#2277FE"
                                                  Data="{StaticResource Geometry.StructureObject.Node}" />
                                        </Viewbox>
                                    </DataTemplate>
                                </Setter.Value>
                            </Setter>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding Path=Model.BaseId}"
                                     Value="1">
                            <Setter Property="ContentTemplate">
                                <Setter.Value>
                                    <DataTemplate>
                                        <Viewbox Stretch="Uniform"
                                                 Width="12">
                                            <Path Stretch="Uniform"
                                                  Fill="#2277FE"
                                                  Data="{StaticResource Geometry.StructureObject}" />
                                        </Viewbox>
                                    </DataTemplate>
                                </Setter.Value>
                            </Setter>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
                <DataTemplate DataType="{x:Type idi:StructureObjectParameter}">
                    <Grid HorizontalAlignment="Left">
                        <Border BorderThickness="0 0 0 1"
                                BorderBrush="Black"
                                Opacity="0.05" />
                        <StackPanel Orientation="Horizontal"
                                    Margin="2 0">
                            <ContentControl x:Name="Image"
                                            Style="{StaticResource StructureObjectParameter.Image }" />
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"
                                                      SharedSizeGroup="Parameter.Name" />
                                    <ColumnDefinition Width="Auto"
                                                      SharedSizeGroup="Parameter.Value" />
                                </Grid.ColumnDefinitions>
                                <TextBlock Grid.Column="0"
                                           Text="{Binding Path=Info, Mode=OneWay, Converter={StaticResource InfoToTextConverter}}"
                                           Margin="{StaticResource Margin.Text}"
                                           VerticalAlignment="Center"
                                           Style="{StaticResource TextBlock.Content}"
                                           FontSize="{StaticResource Font.Size.Small}" />
                                <ContentControl Grid.Column="1"
                                                Margin="20 0 0 0">
                                    <TextBlock Text="{Binding Path=Value, Mode=OneWay, Converter={StaticResource ValueToTextConverter}}"
                                               VerticalAlignment="Center"
                                               Margin="{StaticResource Margin.Text}"
                                               Style="{StaticResource TextBlock.Content}"
                                               FontSize="{StaticResource Font.Size.Small}"
                                               Foreground="{StaticResource Brush.Accent.Strong}" />
                                </ContentControl>
                            </Grid>
                        </StackPanel>
                    </Grid>
                </DataTemplate>
            </DataTemplate.Resources>
            <Grid ClipToBounds="True"
                  DataContext="{Binding Converter={StaticResource StructureObjectViewModelConverter}}">
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="auto" />
                </Grid.RowDefinitions>
                <Grid HorizontalAlignment="Left">
                    <StackPanel Orientation="Horizontal">
                        <ToggleButton x:Name="ExpandButton"
                                      Style="{StaticResource ToggleButton.TreeNode}"
                                      Height="Auto"
                                      MinHeight="25"
                                      IsChecked="{Binding Path=IsExpanded, Mode=TwoWay}"
                                      Tag="{Binding Model, Converter={StaticResource StructureObjectHasChildrenToBooleanConverter}, Mode=OneWay}"
                                      ToolTip="{Binding Path=Model.Name}"
                                      Foreground="{StaticResource Brush.Separator.Strong}">
                            <ToggleButton.Content>
                                <StackPanel Orientation="Vertical">
                                    <StackPanel Orientation="Horizontal">
                                        <ContentControl x:Name="Image"
                                                        Style="{StaticResource StructureObject.Image}" />
                                        <TextBlock Text="{Binding Path=Model.Name, Mode=OneWay}"
                                                   VerticalAlignment="Center"
                                                   Style="{StaticResource TextBlock.Content}" />
                                        <Button Style="{StaticResource Button.Circle}"
                                                Width="12"
                                                Height="12"
                                                Margin="3 0"
                                                Padding="0 1 0 0"
                                                ToolTip="Add measurement"
                                                Command="{Binding ElementName=View, Path=ShowAddMeasurementDialogCommand}"
                                                CommandParameter="{Binding}">
                                            <Button.ContentTemplate>
                                                <DataTemplate>
                                                    <Viewbox Stretch="Uniform"
                                                             Width="6">
                                                        <Path x:Name="Path"
                                                              Data="{StaticResource Geometry.Plus}"
                                                              Fill="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Foreground}" />
                                                    </Viewbox>
                                                </DataTemplate>
                                            </Button.ContentTemplate>
                                        </Button>
                                    </StackPanel>
                                    <TextBlock Style="{StaticResource TextBlock.Comment}"
                                               ToolTip="{Binding Path=Model.Comment}"
                                               MaxWidth="300"
                                               Margin="19 0 20 2"
                                               Text="{Binding Path=Model.Comment, Mode=OneWay}" />
                                </StackPanel>
                            </ToggleButton.Content>
                        </ToggleButton>
                    </StackPanel>
                </Grid>
                <Rectangle x:Name="Placeholder"
                           Grid.Row="1"
                           Style="{StaticResource Placeholder.ScaleY}"
                           Height="{Binding ElementName=ChildrenGrid, Path=ActualHeight, Mode=OneWay}"
                           Tag="{Binding ElementName=ExpandButton, Path=IsChecked, Mode=OneWay}" />
                <Canvas Grid.Row="1">
                    <Grid x:Name="ChildrenGrid"
                          Width="{Binding ElementName=Placeholder, Path=ActualWidth, Mode=OneWay}">
                        <controls:BurnInContent>
                            <controls:BurnInContent.Style>
                                <Style TargetType="{x:Type controls:BurnInContent}">
                                    <Style.Triggers>
                                        <!-- load content only when needed -->
                                        <DataTrigger Binding="{Binding ElementName=ExpandButton, Path=IsChecked}"
                                                     Value="True">
                                            <Setter Property="Content">
                                                <Setter.Value>
                                                    <StackPanel Orientation="Vertical"
                                                                Grid.IsSharedSizeScope="True">
                                                        <ContentControl Content="{Binding}">
                                                            <ContentControl.ContentTemplate>
                                                                <DataTemplate>
                                                                    <Grid ClipToBounds="True"
                                                                          Margin="20 0 0 0"
                                                                          Visibility="{Binding Path=HasParameters, Mode=OneWay, Converter={StaticResource BooleanToVisibilityConverter}}">
                                                                        <Grid.RowDefinitions>
                                                                            <RowDefinition Height="auto" />
                                                                            <RowDefinition Height="auto" />
                                                                        </Grid.RowDefinitions>
                                                                        <Grid.ColumnDefinitions>
                                                                            <ColumnDefinition Width="Auto"
                                                                                              SharedSizeGroup="Parameter.Name" />
                                                                            <ColumnDefinition Width="Auto"
                                                                                              SharedSizeGroup="Parameter.Value" />
                                                                        </Grid.ColumnDefinitions>
                                                                        <ToggleButton x:Name="ExpandParametersToggleButton"
                                                                                      Style="{StaticResource ToggleButton.TreeNode}"
                                                                                      Tag="{Binding Path=HasParameters, Mode=OneWay}">
                                                                            <ToggleButton.Content>
                                                                                <StackPanel Orientation="Horizontal">
                                                                                    <ContentControl Style="{StaticResource StructureObjectParameter.Image}" />
                                                                                    <TextBlock Text="Parameters"
                                                                                               VerticalAlignment="Center"
                                                                                               Style="{StaticResource TextBlock.Content}" />
                                                                                </StackPanel>
                                                                            </ToggleButton.Content>
                                                                        </ToggleButton>
                                                                        <Rectangle x:Name="ParametersPlaceholder"
                                                                                   Grid.Row="1"
                                                                                   Style="{StaticResource Placeholder.ScaleY}"
                                                                                   Height="{Binding ElementName=ParametersGrid, Path=ActualHeight, Mode=OneWay}"
                                                                                   Tag="{Binding ElementName=ExpandParametersToggleButton, Path=IsChecked, Mode=OneWay}" />
                                                                        <Canvas Grid.Row="1">
                                                                            <Grid x:Name="ParametersGrid"
                                                                                  Width="{Binding ElementName=Placeholder, Path=ActualWidth, Mode=OneWay}">
                                                                                <ItemsControl ItemsSource="{Binding Path=Model.Parameters}"
                                                                                              Margin="40 0 0 0" />
                                                                            </Grid>
                                                                        </Canvas>
                                                                    </Grid>
                                                                </DataTemplate>
                                                            </ContentControl.ContentTemplate>
                                                        </ContentControl>
                                                        <ContentPresenter Content="{Binding Path=Model.Children}"
                                                                          Margin="20 0 0 0" />
                                                        <ContentPresenter Content="{Binding Path=Tests}"
                                                                          Margin="20 0 0 0" />
                                                    </StackPanel>
                                                </Setter.Value>
                                            </Setter>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </controls:BurnInContent.Style>
                        </controls:BurnInContent>
                    </Grid>
                </Canvas>
            </Grid>
        </DataTemplate>
    </UserControl.Resources>
    <Grid x:Name="Root"
          d:DataContext="{d:DesignData Type={x:Type local:PadfxBrowser+ViewModel}}">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid x:Name="ToolbarGrid"
              ZIndex="100">
            <Border BorderBrush="{StaticResource Brush.Separator}"
                    Background="{StaticResource Brush.White}"
                    BorderThickness="0 0 0 0">
                <Border.Effect>
                    <DropShadowEffect RenderingBias="Quality"
                                      BlurRadius="10"
                                      ShadowDepth="0"
                                      Opacity="0.5" />
                </Border.Effect>
            </Border>
            <StackPanel Orientation="Horizontal"
                        Margin="2 0">
                <ItemsControl ItemsSource="{Binding Path=FileLoaders, Mode=OneWay}">
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel Orientation="Horizontal" />
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                    <ItemsControl.ItemTemplate>
                        <DataTemplate DataType="{x:Type components:WorkspaceFileLoader}">
                            <Button Style="{StaticResource Button.ToolBar}"
                                    Padding="2"
                                    Width="auto"
                                    Content="{Binding CommandName}"
                                    Command="{Binding ElementName=View, Path=OpenFileCommand}"
                                    CommandParameter="{Binding}">
                                <Button.ContentTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal"
                                                    DataContext="{Binding RelativeSource={RelativeSource AncestorType=Button}}"
                                                    Margin="5 0">
                                            <Viewbox Stretch="Uniform"
                                                     Height="10">
                                                <Path Stretch="Uniform"
                                                      Data="{StaticResource Geometry.OpenFile}"
                                                      Fill="{Binding Path=Foreground}" />
                                            </Viewbox>
                                            <TextBlock Style="{StaticResource TextBlock.Content}"
                                                       Margin="5 0 0 0"
                                                       FontSize="{StaticResource Font.Size.Small}"
                                                       Text="{Binding Path=Content}" />
                                        </StackPanel>
                                    </DataTemplate>
                                </Button.ContentTemplate>
                            </Button>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
                <Button x:Name="SaveFileButton"
                        Style="{StaticResource Button.ToolBar}"
                        Padding="2"
                        Width="auto"
                        Content="Save"
                        Command="{Binding ElementName=View, Path=SaveCommand}">
                    <Button.ContentTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal"
                                        DataContext="{Binding RelativeSource={RelativeSource AncestorType=Button}}"
                                        Margin="5 0">
                                <Viewbox Stretch="Uniform"
                                         Height="12">
                                    <Path Stretch="Uniform"
                                          Data="{StaticResource Geometry.Save}"
                                          Fill="{Binding Path=Foreground}" />
                                </Viewbox>
                                <TextBlock Style="{StaticResource TextBlock.Content}"
                                           Margin="5 0 0 0"
                                           FontSize="{StaticResource Font.Size.Small}"
                                           Text="{Binding Path=Content}" />
                            </StackPanel>
                        </DataTemplate>
                    </Button.ContentTemplate>
                </Button>
                <Rectangle Width="1"
                           VerticalAlignment="Stretch"
                           Margin="2"
                           Fill="{StaticResource Brush.Separator}"></Rectangle>
                <ToggleButton x:Name="ExportToggleButton"
                              IsChecked="False"
                              Style="{StaticResource ToggleButton.ToolBar}"
                              Width="auto"
                              Content="Export ...">
                    <ToggleButton.ContentTemplate>
                        <DataTemplate>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="auto" />
                                    <ColumnDefinition Width="auto" />
                                </Grid.ColumnDefinitions>
                                <Grid x:Name="IconGrid"
                                      Width="20">
                                    <Viewbox Stretch="Uniform"
                                             Height="10">
                                        <Path Stretch="Uniform"
                                              Data="{StaticResource Geometry.Export}"
                                              Fill="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton}, Path=Foreground}" />
                                    </Viewbox>
                                </Grid>
                                <TextBlock Grid.Column="1"
                                           x:Name="ContentText"
                                           Style="{StaticResource TextBlock.Content}"
                                           FontSize="{StaticResource Font.Size.Small}"
                                           Text="{Binding}"
                                           Foreground="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton}, Path=Foreground}" />
                            </Grid>
                        </DataTemplate>
                    </ToggleButton.ContentTemplate>
                </ToggleButton>
                <Popup Placement="Bottom"
                       IsOpen="{Binding ElementName=ExportToggleButton, Path=IsChecked, Mode=TwoWay}"
                       PlacementTarget="{Binding ElementName=ExportToggleButton}"
                       StaysOpen="False"
                       VerticalOffset="5"
                       AllowsTransparency="True"
                       Opened="Popup_OnOpened">
                    <Grid Margin="{StaticResource Margin.Content}"
                          MinWidth="100">
                        <Border Background="{StaticResource Brush.White}"
                                BorderThickness="1"
                                BorderBrush="{StaticResource Brush.Separator}"
                                Effect="{StaticResource Shadow.Popup}" />
                        <Grid Margin="1 1 1 3">
                            <StackPanel Orientation="Vertical">
                                <ItemsControl ItemsSource="{Binding Path=FileExporters, Mode=OneWay}">
                                    <ItemsControl.ItemTemplate>
                                        <DataTemplate>
                                            <Button Style="{StaticResource Button.ToolBar}"
                                                    Margin="2 2 2 0"
                                                    Width="auto"
                                                    Content="{Binding CommandName}"
                                                    CommandParameter="{Binding}"
                                                    Command="{Binding ElementName=View, Path=ExportCommand}" />
                                        </DataTemplate>
                                    </ItemsControl.ItemTemplate>
                                </ItemsControl>
                            </StackPanel>
                        </Grid>
                    </Grid>
                    <Popup.Triggers>
                        <EventTrigger RoutedEvent="Border.MouseUp">
                            <BeginStoryboard>
                                <Storyboard>
                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExportToggleButton"
                                                                   Storyboard.TargetProperty="IsChecked">
                                        <DiscreteObjectKeyFrame KeyTime="0%">
                                            <DiscreteObjectKeyFrame.Value>
                                                <system:Boolean>False</system:Boolean>
                                            </DiscreteObjectKeyFrame.Value>
                                        </DiscreteObjectKeyFrame>
                                    </ObjectAnimationUsingKeyFrames>
                                </Storyboard>
                            </BeginStoryboard>
                        </EventTrigger>
                    </Popup.Triggers>
                </Popup>
                <Rectangle Width="1"
                           VerticalAlignment="Stretch"
                           Margin="2"
                           Fill="{StaticResource Brush.Separator}"></Rectangle>
                <ToggleButton x:Name="BaudRateToggleButton"
                              IsChecked="False"
                              Style="{StaticResource ToggleButton.ToolBar}"
                              Width="auto"
                              Content="{Binding ElementName=View, Path=SelectedBaudRate}">
                    <ToggleButton.ContentTemplate>
                        <DataTemplate>
                            <Grid>
                                <TextBlock x:Name="ContentText"
                                           Style="{StaticResource TextBlock.Content}"
                                           FontSize="{StaticResource Font.Size.Small}"
                                           Text="{Binding StringFormat={}{0} Baud}"
                                           Foreground="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton}, Path=Foreground}" />
                            </Grid>
                            <DataTemplate.Triggers>
                                <DataTrigger Binding="{Binding}"
                                             Value="{x:Null}">
                                    <Setter TargetName="ContentText"
                                            Property="Text"
                                            Value="Select transfer speed" />
                                </DataTrigger>
                            </DataTemplate.Triggers>
                        </DataTemplate>
                    </ToggleButton.ContentTemplate>
                </ToggleButton>
                <Popup Placement="Bottom"
                       IsOpen="{Binding ElementName=BaudRateToggleButton, Path=IsChecked, Mode=TwoWay}"
                       PlacementTarget="{Binding ElementName=BaudRateToggleButton}"
                       StaysOpen="False"
                       VerticalOffset="5"
                       AllowsTransparency="True">
                    <Grid Margin="{StaticResource Margin.Content}"
                          MinWidth="100">
                        <Border Background="{StaticResource Brush.White}"
                                BorderThickness="1"
                                BorderBrush="{StaticResource Brush.Separator}"
                                Effect="{StaticResource Shadow.Popup}" />
                        <Grid Margin="1">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="auto" />
                                <RowDefinition Height="auto" />
                            </Grid.RowDefinitions>
                            <Border BorderThickness="0 0 0 0"
                                    Background="{StaticResource Brush.Background}"
                                    BorderBrush="{StaticResource Brush.Separator}">
                                <TextBlock Text="Select transfer speed"
                                           Margin="{StaticResource Margin.Text}"
                                           FontSize="{StaticResource Font.Size.Tiny}"
                                           Foreground="{StaticResource Brush.Accent.Strong}" />
                            </Border>
                            <ListBox Grid.Row="1"
                                     ItemsSource="{Binding ElementName=View, Path=AvailableBaudRates}"
                                     SelectedItem="{Binding ElementName=View, Path=SelectedBaudRate, Mode=TwoWay}">
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <Grid Background="Transparent"
                                              IsHitTestVisible="True">
                                            <TextBlock Text="{Binding StringFormat={}{0} Baud}"
                                                       Style="{StaticResource TextBlock.Content}"
                                                       Margin="{StaticResource Margin.Text}"
                                                       HorizontalAlignment="Right" />
                                        </Grid>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
                        </Grid>
                    </Grid>
                    <Popup.Triggers>
                        <EventTrigger RoutedEvent="Border.MouseUp">
                            <BeginStoryboard>
                                <Storyboard>
                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="BaudRateToggleButton"
                                                                   Storyboard.TargetProperty="IsChecked">
                                        <DiscreteObjectKeyFrame KeyTime="0%">
                                            <DiscreteObjectKeyFrame.Value>
                                                <system:Boolean>False</system:Boolean>
                                            </DiscreteObjectKeyFrame.Value>
                                        </DiscreteObjectKeyFrame>
                                    </ObjectAnimationUsingKeyFrames>
                                </Storyboard>
                            </BeginStoryboard>
                        </EventTrigger>
                    </Popup.Triggers>
                </Popup>
                <ToggleButton x:Name="PortToggleButton"
                              IsChecked="False"
                              Style="{StaticResource ToggleButton.ToolBar}"
                              Width="auto"
                              Content="{Binding ElementName=View, Path=SelectedPort}">
                    <ToggleButton.ContentTemplate>
                        <DataTemplate>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="auto" />
                                    <ColumnDefinition Width="auto" />
                                </Grid.ColumnDefinitions>
                                <Grid x:Name="IconGrid"
                                      Width="20">
                                    <Viewbox x:Name="OnlineViewbox"
                                             Stretch="Uniform"
                                             Width="10"
                                             Visibility="Hidden">
                                        <Path Data="{StaticResource Geometry.Check.Circle}"
                                              Fill="{StaticResource Brush.Marker.Confirm}"
                                              Stretch="Uniform" />
                                    </Viewbox>
                                    <Viewbox x:Name="OfflineViewbox"
                                             Stretch="Uniform"
                                             Visibility="Hidden"
                                             Width="10">
                                        <Path Data="{StaticResource Geometry.Link.Offline}"
                                              Fill="{StaticResource Brush.Marker.Reject}"
                                              Stretch="Uniform" />
                                    </Viewbox>
                                    <Viewbox x:Name="LoadingViewbox"
                                             Stretch="Uniform"
                                             Width="10"
                                             Visibility="Hidden"
                                             RenderTransformOrigin="0.5, 0.5">
                                        <Viewbox.RenderTransform>
                                            <RotateTransform Angle="0" />
                                        </Viewbox.RenderTransform>
                                        <Path Data="{StaticResource Geometry.Loading.Circle}"
                                              Fill="{StaticResource Brush.Foreground}"
                                              Stretch="Uniform" />
                                    </Viewbox>
                                </Grid>
                                <TextBlock Grid.Column="1"
                                           x:Name="ContentText"
                                           Style="{StaticResource TextBlock.Content}"
                                           FontSize="{StaticResource Font.Size.Small}"
                                           Text="{Binding}"
                                           Foreground="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton}, Path=Foreground}" />
                            </Grid>
                            <DataTemplate.Triggers>
                                <DataTrigger Binding="{Binding ElementName=View, Path=IsOnline}"
                                             Value="{x:Null}">
                                    <DataTrigger.EnterActions>
                                        <BeginStoryboard>
                                            <Storyboard RepeatBehavior="Forever">
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LoadingViewbox"
                                                                               Storyboard.TargetProperty="Visibility">
                                                    <DiscreteObjectKeyFrame KeyTime="0%">
                                                        <DiscreteObjectKeyFrame.Value>
                                                            <Visibility>Visible</Visibility>
                                                        </DiscreteObjectKeyFrame.Value>
                                                    </DiscreteObjectKeyFrame>
                                                </ObjectAnimationUsingKeyFrames>
                                                <DoubleAnimation Storyboard.TargetName="LoadingViewbox"
                                                                 Storyboard.TargetProperty="RenderTransform.(RotateTransform.Angle)"
                                                                 Duration="0:0:2.5"
                                                                 To="359" />
                                            </Storyboard>
                                        </BeginStoryboard>
                                    </DataTrigger.EnterActions>
                                    <DataTrigger.ExitActions>
                                        <BeginStoryboard>
                                            <Storyboard RepeatBehavior="Forever">
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LoadingViewbox"
                                                                               Storyboard.TargetProperty="Visibility">
                                                    <DiscreteObjectKeyFrame KeyTime="0%">
                                                        <DiscreteObjectKeyFrame.Value>
                                                            <Visibility>Hidden</Visibility>
                                                        </DiscreteObjectKeyFrame.Value>
                                                    </DiscreteObjectKeyFrame>
                                                </ObjectAnimationUsingKeyFrames>
                                                <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LoadingViewbox"
                                                                               Storyboard.TargetProperty="RenderTransform.(RotateTransform.Angle)">
                                                    <DiscreteObjectKeyFrame KeyTime="0%">
                                                        <DiscreteObjectKeyFrame.Value>
                                                            <system:Double>0</system:Double>
                                                        </DiscreteObjectKeyFrame.Value>
                                                    </DiscreteObjectKeyFrame>
                                                </ObjectAnimationUsingKeyFrames>
                                            </Storyboard>
                                        </BeginStoryboard>
                                    </DataTrigger.ExitActions>
                                </DataTrigger>
                                <DataTrigger Binding="{Binding ElementName=View, Path=IsOnline}"
                                             Value="True">
                                    <Setter TargetName="OnlineViewbox"
                                            Property="Visibility"
                                            Value="Visible" />
                                    <Setter TargetName="OfflineViewbox"
                                            Property="Visibility"
                                            Value="Hidden" />
                                </DataTrigger>
                                <DataTrigger Binding="{Binding ElementName=View, Path=IsOnline}"
                                             Value="False">
                                    <Setter TargetName="OnlineViewbox"
                                            Property="Visibility"
                                            Value="Hidden" />
                                    <Setter TargetName="OfflineViewbox"
                                            Property="Visibility"
                                            Value="Visible" />
                                </DataTrigger>
                                <DataTrigger Binding="{Binding}"
                                             Value="{x:Null}">
                                    <Setter TargetName="ContentText"
                                            Property="Text"
                                            Value="Select port" />
                                    <Setter TargetName="IconGrid"
                                            Property="Visibility"
                                            Value="Collapsed" />
                                </DataTrigger>
                            </DataTemplate.Triggers>
                        </DataTemplate>
                    </ToggleButton.ContentTemplate>
                </ToggleButton>
                <Popup Placement="Bottom"
                       IsOpen="{Binding ElementName=PortToggleButton, Path=IsChecked, Mode=TwoWay}"
                       PlacementTarget="{Binding ElementName=PortToggleButton}"
                       StaysOpen="False"
                       VerticalOffset="5"
                       AllowsTransparency="True">
                    <Grid Margin="{StaticResource Margin.Content}"
                          MinWidth="100">
                        <Border Background="{StaticResource Brush.White}"
                                BorderThickness="1"
                                BorderBrush="{StaticResource Brush.Separator}"
                                Effect="{StaticResource Shadow.Popup}" />
                        <Grid Margin="1"
                              HorizontalAlignment="Stretch">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="auto" />
                                <RowDefinition Height="auto" />
                            </Grid.RowDefinitions>
                            <Border BorderThickness="0 0 0 0"
                                    Background="{StaticResource Brush.Background}"
                                    BorderBrush="{StaticResource Brush.Separator}">
                                <Grid>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="*" />
                                        <ColumnDefinition Width="auto" />
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Text="Select port"
                                               Margin="{StaticResource Margin.Text}"
                                               FontSize="{StaticResource Font.Size.Tiny}"
                                               Foreground="{StaticResource Brush.Accent.Strong}" />
                                    <Button Grid.Column="1"
                                            Style="{StaticResource Button.ListItem}"
                                            MinWidth="0"
                                            Width="20"
                                            Height="auto"
                                            BorderThickness="0"
                                            ToolTip="Refresh"
                                            Command="{Binding ElementName=View, Path=RefreshAvailablePortsCommand}">
                                        <Button.ContentTemplate>
                                            <DataTemplate>
                                                <Viewbox Stretch="Uniform"
                                                         Width="10">
                                                    <Path Data="{StaticResource Geometry.Refresh}"
                                                          Fill="{StaticResource Brush.Accent.Strong}"
                                                          Stretch="Uniform" />
                                                </Viewbox>
                                            </DataTemplate>
                                        </Button.ContentTemplate>
                                    </Button>
                                </Grid>
                            </Border>
                            <StackPanel Orientation="Vertical"
                                        Grid.Row="1">
                                <ListBox ItemsSource="{Binding ElementName=View, Path=AvailablePorts}"
                                         SelectedItem="{Binding ElementName=View, Path=SelectedPort, Mode=TwoWay}">
                                    <ListBox.ItemTemplate>
                                        <DataTemplate>
                                            <Border Background="Transparent"
                                                    IsHitTestVisible="True">
                                                <TextBlock Text="{Binding}"
                                                           Style="{StaticResource TextBlock.Content}"
                                                           Margin="{StaticResource Margin.Text}" />
                                            </Border>
                                        </DataTemplate>
                                    </ListBox.ItemTemplate>
                                </ListBox>
                            </StackPanel>
                        </Grid>
                    </Grid>
                    <Popup.Triggers>
                        <EventTrigger RoutedEvent="Border.MouseUp">
                            <BeginStoryboard>
                                <Storyboard>
                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PortToggleButton"
                                                                   Storyboard.TargetProperty="IsChecked">
                                        <DiscreteObjectKeyFrame KeyTime="0%">
                                            <DiscreteObjectKeyFrame.Value>
                                                <system:Boolean>False</system:Boolean>
                                            </DiscreteObjectKeyFrame.Value>
                                        </DiscreteObjectKeyFrame>
                                    </ObjectAnimationUsingKeyFrames>
                                </Storyboard>
                            </BeginStoryboard>
                        </EventTrigger>
                    </Popup.Triggers>
                </Popup>
                <Button x:Name="DownloadButton"
                        Style="{StaticResource Button.ToolBar}"
                        Padding="2"
                        Width="auto"
                        Content="Download"
                        Command="{Binding ElementName=View, Path=DownloadCommand}"
                        CommandParameter="{Binding ElementName=View, Path=SelectedPort}">
                    <Button.ContentTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal"
                                        DataContext="{Binding RelativeSource={RelativeSource AncestorType=Button}}"
                                        Margin="5 0">
                                <Viewbox Stretch="Uniform"
                                         Height="10">
                                    <Path Stretch="Uniform"
                                          Data="{StaticResource Geometry.Download}"
                                          Fill="{Binding Path=Foreground}" />
                                </Viewbox>
                                <TextBlock Style="{StaticResource TextBlock.Content}"
                                           Margin="5 0 0 0"
                                           FontSize="{StaticResource Font.Size.Small}"
                                           Text="{Binding Path=Content}" />
                            </StackPanel>
                        </DataTemplate>
                    </Button.ContentTemplate>
                </Button>
                <Button x:Name="UploadButton"
                        Style="{StaticResource Button.ToolBar}"
                        Padding="2"
                        Width="auto"
                        Content="Upload"
                        Command="{Binding ElementName=View, Path=UploadCommand}"
                        CommandParameter="{Binding ElementName=View, Path=SelectedPort}">
                    <Button.ContentTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal"
                                        DataContext="{Binding RelativeSource={RelativeSource AncestorType=Button}}"
                                        Margin="5 0">
                                <Viewbox Stretch="Uniform"
                                         Height="10">
                                    <Path Stretch="Uniform"
                                          Data="{StaticResource Geometry.Upload}"
                                          Fill="{Binding Path=Foreground}" />
                                </Viewbox>
                                <TextBlock Style="{StaticResource TextBlock.Content}"
                                           Margin="5 0 0 0"
                                           FontSize="{StaticResource Font.Size.Small}"
                                           Text="{Binding Path=Content}" />
                            </StackPanel>
                        </DataTemplate>
                    </Button.ContentTemplate>
                </Button>
                <Button x:Name="InstrumentInfoButton"
                        Style="{StaticResource Button.ToolBar}"
                        Padding="2"
                        Width="auto"
                        Content="Instrument"
                        ToolTip="Show instrument information"
                        Command="{Binding ElementName=View, Path=ShowInstrumentInfoCommand}"
                        CommandParameter="{Binding ElementName=View, Path=SelectedPort}">
                    <Button.ContentTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal"
                                        DataContext="{Binding RelativeSource={RelativeSource AncestorType=Button}}"
                                        Margin="5 0">
                                <Viewbox Stretch="Uniform"
                                         Height="10">
                                    <Path Stretch="Uniform"
                                          Data="{StaticResource Geometry.Info}"
                                          Fill="{Binding Path=Foreground}" />
                                </Viewbox>
                                <TextBlock Style="{StaticResource TextBlock.Content}"
                                           Margin="5 0 0 0"
                                           FontSize="{StaticResource Font.Size.Small}"
                                           Text="{Binding Path=Content}" />
                            </StackPanel>
                        </DataTemplate>
                    </Button.ContentTemplate>
                </Button>
                <Button x:Name="UploadLicense"
                        Style="{StaticResource Button.ToolBar}"
                        Padding="2"
                        Width="auto"
                        Content="Upload license"
                        Command="{Binding ElementName=View, Path=ShowUploadLicenseDialogCommand}">
                    <Button.ContentTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal"
                                        DataContext="{Binding RelativeSource={RelativeSource AncestorType=Button}}"
                                        Margin="5 0">
                                <Viewbox Stretch="Uniform"
                                         Height="10">
                                    <Path Stretch="Uniform"
                                          Data="{StaticResource Geometry.License}"
                                          Fill="{Binding Path=Foreground}" />
                                </Viewbox>
                                <TextBlock Style="{StaticResource TextBlock.Content}"
                                           Margin="5 0 0 0"
                                           FontSize="{StaticResource Font.Size.Small}"
                                           Text="{Binding Path=Content}" />
                            </StackPanel>
                        </DataTemplate>
                    </Button.ContentTemplate>
                </Button>
                <Button x:Name="CheckFirmwareUpdateButton"
                        Style="{StaticResource Button.ToolBar}"
                        Padding="2"
                        Width="auto"
                        Content="Check for updates"
                        Command="{Binding ElementName=View, Path=CheckFirmwareUpdateCommand}">
                    <Button.ContentTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal"
                                        DataContext="{Binding RelativeSource={RelativeSource AncestorType=Button}}"
                                        Margin="5 0">
                                <Viewbox Stretch="Uniform"
                                         Height="10">
                                    <Path Stretch="Uniform"
                                          Data="{StaticResource Geometry.Update}"
                                          Fill="{Binding Path=Foreground}" />
                                </Viewbox>
                                <TextBlock Style="{StaticResource TextBlock.Content}"
                                           Margin="5 0 0 0"
                                           FontSize="{StaticResource Font.Size.Small}"
                                           Text="{Binding Path=Content}" />
                            </StackPanel>
                        </DataTemplate>
                    </Button.ContentTemplate>
                </Button>
            </StackPanel>
        </Grid>
        <Grid x:Name="ContentGrid"
              Grid.Row="1"
              DataContext="{Binding Path=SelectedWorkspace, Mode=OneWay}">
            <ScrollViewer>
                <StackPanel Margin="{StaticResource Margin.Content}">
                    <ContentPresenter x:Name="StructureObjectsPresenter"
                                      Content="{Binding Path=StructureObjects}" />
                    <ContentControl Visibility="{Binding Converter={StaticResource NotNullToVisibilityConverter}}">
                        <Grid ClipToBounds="True"
                              x:Name="InstrumentsGrid"
                              Visibility="{Binding Path=HasInstruments, Converter={StaticResource BooleanToVisibilityConverter}}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="auto" />
                                <RowDefinition Height="auto" />
                            </Grid.RowDefinitions>
                            <Grid HorizontalAlignment="Left">
                                <ToggleButton x:Name="InstrumentsExpandButton"
                                              Height="Auto"
                                              MinHeight="25"
                                              Style="{StaticResource ToggleButton.TreeNode}"
                                              Tag="True"
                                              Foreground="{StaticResource Brush.Separator.Strong}">
                                    <ToggleButton.Content>
                                        <StackPanel Orientation="Horizontal">
                                            <ContentControl x:Name="Image"
                                                            Margin="5 0 0 0">
                                                <ContentControl.ContentTemplate>
                                                    <DataTemplate>
                                                        <Viewbox Stretch="Uniform"
                                                                 HorizontalAlignment="Center"
                                                                 VerticalAlignment="Center"
                                                                 Margin="2 0 0 0"
                                                                 Height="10">
                                                            <Path Stretch="Uniform"
                                                                  Fill="{StaticResource Brush.Instrument}"
                                                                  Data="{StaticResource Geometry.Instrument}" />
                                                        </Viewbox>
                                                    </DataTemplate>
                                                </ContentControl.ContentTemplate>
                                            </ContentControl>
                                            <TextBlock Text="Instruments"
                                                       Style="{StaticResource TextBlock.Content}"
                                                       Margin="5 0" />
                                        </StackPanel>
                                    </ToggleButton.Content>
                                </ToggleButton>
                            </Grid>
                            <Rectangle x:Name="Placeholder"
                                       Grid.Row="1"
                                       Style="{StaticResource Placeholder.ScaleY}"
                                       Height="{Binding ElementName=InstrumentsListGrid, Path=ActualHeight, Mode=OneWay}"
                                       Tag="{Binding ElementName=InstrumentsExpandButton, Path=IsChecked, Mode=OneWay}" />
                            <Canvas Grid.Row="1">
                                <Grid x:Name="InstrumentsListGrid"
                                      Width="{Binding ElementName=Placeholder, Path=ActualWidth, Mode=OneWay}">
                                    <controls:BurnInContent>
                                        <controls:BurnInContent.Style>
                                            <Style TargetType="{x:Type controls:BurnInContent}">
                                                <Style.Triggers>
                                                    <!-- load content only when needed -->
                                                    <DataTrigger Binding="{Binding ElementName=InstrumentsExpandButton, Path=IsChecked}"
                                                                 Value="True">
                                                        <Setter Property="Content">
                                                            <Setter.Value>
                                                                <ContentControl Content="{Binding}">
                                                                    <ContentControl.ContentTemplate>
                                                                        <DataTemplate>
                                                                            <StackPanel Orientation="Vertical"
                                                                                        Grid.IsSharedSizeScope="True">
                                                                                <Grid x:Name="InstrumentsListHeadersGrid"
                                                                                      Margin="40 0 0 0">
                                                                                    <Grid.Resources>
                                                                                        <Style TargetType="TextBlock"
                                                                                               BasedOn="{StaticResource TextBlock.Content}">
                                                                                            <Setter Property="Foreground"
                                                                                                    Value="{StaticResource Brush.Accent.Strong}" />
                                                                                            <Setter Property="Margin"
                                                                                                    Value="{StaticResource Margin.Text}" />
                                                                                        </Style>
                                                                                        <Style TargetType="Border">
                                                                                            <Setter Property="BorderBrush"
                                                                                                    Value="{StaticResource Brush.Separator}" />
                                                                                            <Setter Property="BorderThickness"
                                                                                                    Value="0 0 1 0" />
                                                                                            <Setter Property="Opacity"
                                                                                                    Value="0.2" />
                                                                                        </Style>
                                                                                    </Grid.Resources>
                                                                                    <Grid.ColumnDefinitions>
                                                                                        <ColumnDefinition Width="Auto"
                                                                                                          SharedSizeGroup="Instrument_MetrelInstrumentName" />
                                                                                        <ColumnDefinition Width="Auto"
                                                                                                          SharedSizeGroup="Instrument_Guid" />
                                                                                        <ColumnDefinition Width="Auto"
                                                                                                          SharedSizeGroup="Instrument_HardwareVersion" />
                                                                                        <ColumnDefinition Width="Auto"
                                                                                                          SharedSizeGroup="Instrument_SoftwareVersion" />
                                                                                    </Grid.ColumnDefinitions>
                                                                                    <Border Grid.ColumnSpan="4"
                                                                                            Background="{StaticResource Brush.Background.Strong}"
                                                                                            BorderThickness="0 0 0 1" />
                                                                                    <Border Grid.Column="0" />
                                                                                    <TextBlock Grid.Column="0"
                                                                                               Text="Name" />
                                                                                    <Border Grid.Column="1" />
                                                                                    <TextBlock Grid.Column="1"
                                                                                               Text="Id" />
                                                                                    <Border Grid.Column="2" />
                                                                                    <TextBlock Grid.Column="2"
                                                                                               Text="HW Version" />
                                                                                    <TextBlock Grid.Column="3"
                                                                                               Text="SW Version" />
                                                                                </Grid>
                                                                                <ItemsControl ItemsSource="{Binding Path=Instruments, Converter={StaticResource IEnumerableToTestListConverter}}"
                                                                                              Margin="40 0 0 0" />
                                                                            </StackPanel>
                                                                        </DataTemplate>
                                                                    </ContentControl.ContentTemplate>
                                                                </ContentControl>
                                                            </Setter.Value>
                                                        </Setter>
                                                    </DataTrigger>
                                                </Style.Triggers>
                                            </Style>
                                        </controls:BurnInContent.Style>
                                    </controls:BurnInContent>
                                </Grid>
                            </Canvas>
                        </Grid>
                    </ContentControl>
                    <ContentControl Visibility="{Binding Converter={StaticResource NotNullToVisibilityConverter}}">
                        <Grid ClipToBounds="True"
                              x:Name="UsersGrid"
                              Visibility="{Binding Path=HasUsers, Converter={StaticResource BooleanToVisibilityConverter}}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="auto" />
                                <RowDefinition Height="auto" />
                            </Grid.RowDefinitions>
                            <Grid HorizontalAlignment="Left">
                                <ToggleButton x:Name="UsersExpandButton"
                                              Height="Auto"
                                              MinHeight="25"
                                              Style="{StaticResource ToggleButton.TreeNode}"
                                              Tag="True"
                                              Foreground="{StaticResource Brush.Separator.Strong}">
                                    <ToggleButton.Content>
                                        <StackPanel Orientation="Horizontal">
                                            <ContentControl Margin="5 0 0 0">
                                                <ContentControl.ContentTemplate>
                                                    <DataTemplate>
                                                        <Viewbox Stretch="Uniform"
                                                                 HorizontalAlignment="Center"
                                                                 VerticalAlignment="Center"
                                                                 Margin="2 0 0 0"
                                                                 Height="10">
                                                            <Path Stretch="Uniform"
                                                                  Fill="{StaticResource Brush.User}"
                                                                  Data="{StaticResource Geometry.User}" />
                                                        </Viewbox>
                                                    </DataTemplate>
                                                </ContentControl.ContentTemplate>
                                            </ContentControl>
                                            <TextBlock Text="Users"
                                                       Style="{StaticResource TextBlock.Content}"
                                                       Margin="5 0" />
                                        </StackPanel>
                                    </ToggleButton.Content>
                                </ToggleButton>
                            </Grid>
                            <Rectangle x:Name="UsersListPlaceholder"
                                       Grid.Row="1"
                                       Style="{StaticResource Placeholder.ScaleY}"
                                       Height="{Binding ElementName=UsersListGrid, Path=ActualHeight, Mode=OneWay}"
                                       Tag="{Binding ElementName=UsersExpandButton, Path=IsChecked, Mode=OneWay}" />
                            <Canvas Grid.Row="1">
                                <Grid x:Name="UsersListGrid"
                                      Width="{Binding ElementName=UsersListPlaceholder, Path=ActualWidth, Mode=OneWay}">
                                    <controls:BurnInContent>
                                        <controls:BurnInContent.Style>
                                            <Style TargetType="{x:Type controls:BurnInContent}">
                                                <Style.Triggers>
                                                    <!-- load content only when needed -->
                                                    <DataTrigger Binding="{Binding ElementName=UsersExpandButton, Path=IsChecked}"
                                                                 Value="True">
                                                        <Setter Property="Content">
                                                            <Setter.Value>
                                                                <ContentControl Content="{Binding}">
                                                                    <ContentControl.ContentTemplate>
                                                                        <DataTemplate>
                                                                            <StackPanel Orientation="Vertical"
                                                                                        Grid.IsSharedSizeScope="True">
                                                                                <Grid x:Name="UsersListHeadersGrid"
                                                                                      Margin="40 0 0 0">
                                                                                    <Grid.Resources>
                                                                                        <Style TargetType="TextBlock"
                                                                                               BasedOn="{StaticResource TextBlock.Content}">
                                                                                            <Setter Property="Foreground"
                                                                                                    Value="{StaticResource Brush.Accent.Strong}" />
                                                                                            <Setter Property="Margin"
                                                                                                    Value="{StaticResource Margin.Text}" />
                                                                                        </Style>
                                                                                        <Style TargetType="Border">
                                                                                            <Setter Property="BorderBrush"
                                                                                                    Value="{StaticResource Brush.Separator}" />
                                                                                            <Setter Property="BorderThickness"
                                                                                                    Value="0 0 1 0" />
                                                                                            <Setter Property="Opacity"
                                                                                                    Value="0.2" />
                                                                                        </Style>
                                                                                    </Grid.Resources>
                                                                                    <Grid.ColumnDefinitions>
                                                                                        <ColumnDefinition Width="Auto"
                                                                                                          SharedSizeGroup="User_Name" />
                                                                                        <ColumnDefinition Width="Auto"
                                                                                                          SharedSizeGroup="User_Guid" />
                                                                                    </Grid.ColumnDefinitions>
                                                                                    <Border Grid.ColumnSpan="4"
                                                                                            Background="{StaticResource Brush.Background.Strong}"
                                                                                            BorderThickness="0 0 0 1" />
                                                                                    <Border Grid.Column="0" />
                                                                                    <TextBlock Grid.Column="0"
                                                                                               Text="Name" />
                                                                                    <TextBlock Grid.Column="1"
                                                                                               Text="Id" />
                                                                                </Grid>
                                                                                <ItemsControl ItemsSource="{Binding Path=Users}"
                                                                                              Margin="40 0 0 0" />
                                                                            </StackPanel>
                                                                        </DataTemplate>
                                                                    </ContentControl.ContentTemplate>
                                                                </ContentControl>
                                                            </Setter.Value>
                                                        </Setter>
                                                    </DataTrigger>
                                                </Style.Triggers>
                                            </Style>
                                        </controls:BurnInContent.Style>
                                    </controls:BurnInContent>
                                </Grid>
                            </Canvas>
                        </Grid>
                    </ContentControl>
                </StackPanel>
            </ScrollViewer>
        </Grid>
        <Grid x:Name="StatusBarGrid"
              Grid.Row="2"
              Visibility="{Binding Path=SelectedWorkspace, Converter={StaticResource NotNullToVisibilityConverter}}">
            <Border BorderBrush="{StaticResource Brush.Black}"
                    BorderThickness="0 1 0 0"
                    Background="{StaticResource Brush.Background.Weak}"
                    Opacity="0.2" />
            <StackPanel Orientation="Horizontal"
                        VerticalAlignment="Stretch">
                <StackPanel.Resources>
                    <Style TargetType="Label"
                           BasedOn="{StaticResource Label.Left}">
                        <Setter Property="VerticalAlignment"
                                Value="Center" />
                    </Style>
                    <Style TargetType="TextBlock"
                           BasedOn="{StaticResource TextBlock.Content}">
                        <Setter Property="Margin"
                                Value="5 5 10 5" />
                        <Setter Property="FontSize"
                                Value="{StaticResource Font.Size.Small}" />
                    </Style>
                    <Style TargetType="TextBox"
                           BasedOn="{StaticResource TextBox.Undefined}">
                        <Setter Property="FontSize"
                                Value="{StaticResource Font.Size.Small}" />
                        <Setter Property="Margin"
                                Value="5 0 10 0" />
                    </Style>
                </StackPanel.Resources>
                <Label Style="{StaticResource Label.Left}"
                       Content="Workspace Name:" />
                <TextBox Text="{Binding Path=SelectedWorkspace.Name, UpdateSourceTrigger=PropertyChanged}"
                         MinWidth="30"
                         MaxWidth="200"
                         VerticalAlignment="Center" />
                <Rectangle Width="1"
                           VerticalAlignment="Stretch"
                           Margin="2"
                           Fill="{StaticResource Brush.Separator}"></Rectangle>
                <Label Style="{StaticResource Label.Left}"
                       Content="Region:" />
                <TextBlock Text="{Binding Path=WorkspaceRegion, Converter={StaticResource InfoToTextConverter}}" />
            </StackPanel>
        </Grid>
        <ContentControl x:Name="DialogContent"
                        Grid.RowSpan="2"
                        Tag="{Binding ElementName=DialogPresenter, Path=Content, Converter={StaticResource NotNullToBooleanConverter}}"
                        Style="{StaticResource ContentControl.Dialog}">
            <Grid>
                <Rectangle Fill="{StaticResource Brush.Black}"
                           Opacity="0.20" />
                <Grid VerticalAlignment="Center"
                      HorizontalAlignment="Center"
                      Margin="0"
                      SnapsToDevicePixels="True">
                    <Border Background="{StaticResource Brush.White}"
                            SnapsToDevicePixels="True"
                            Margin="0"
                            Effect="{StaticResource Shadow.Popup}" />
                    <ContentControl x:Name="DialogPresenter"
                                    Margin="0"
                                    Content="{x:Null}" />
                </Grid>
            </Grid>
        </ContentControl>
    </Grid>
</UserControl>
