<Window x:Class="StructureHelper.Windows.MainWindow.Analyses.VersionsView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:StructureHelper.Windows.MainWindow.Analyses"
        xmlns:uc="clr-namespace:StructureHelper.Windows.UserControls"
        d:DataContext="{d:DesignInstance local:VersionsViewModel}"
        mc:Ignorable="d"
        Title="Version Viewer" Height="250" Width="400" MinHeight="250" MinWidth="400" MaxHeight="800" MaxWidth="1000" WindowStartupLocation="CenterScreen">
    <Grid>
        <DockPanel>
            <ToolBarTray DockPanel.Dock="Top">
                <ToolBar>
                    <Button Style="{StaticResource ToolButton}" 
                        Command="{Binding AddNewVersionCommand}">
                        <Button.ToolTip>
                            <uc:ButtonToolTipEh HeaderText="Fix current version"
                                                IconContent="{StaticResource CopyAnalysis}"
                                                DescriptionText="Create new version of analysis from selected one"/>
                        </Button.ToolTip>
                        <Viewbox>
                            <ContentControl ContentTemplate="{DynamicResource CopyAnalysis}"/>
                        </Viewbox>
                    </Button>
                    <Button Style="{StaticResource ToolButton}" 
                        Command="{Binding ReturnToVersionCommand}">
                        <Button.ToolTip>
                            <uc:ButtonToolTipEh HeaderText="Restore to selected version"
                                                IconContent="{StaticResource RestoreAndDelete}"
                                                DescriptionText="Removes all versions which are younger than selected one"/>
                        </Button.ToolTip>
                        <Viewbox>
                            <ContentControl ContentTemplate="{DynamicResource RestoreAndDelete}"/>
                        </Viewbox>
                    </Button>
                    <Button Style="{StaticResource ToolButton}" 
                        Command="{Binding DeleteVersionCommand}">
                        <Button.ToolTip>
                            <uc:ButtonToolTipEh HeaderText="Delete selected version"
                                                IconContent="{StaticResource DeleteEntity}"
                                                DescriptionText="Deletes selected version (not available for unique version)"/>
                        </Button.ToolTip>
                        <Viewbox>
                            <ContentControl ContentTemplate="{DynamicResource DeleteEntity}"/>
                        </Viewbox>
                    </Button>
                    <Button Style="{StaticResource ToolButton}" 
                        Command="{Binding ExportToNewCommand}">
                        <Button.ToolTip>
                            <uc:ButtonToolTipEh HeaderText="Export to new analysis"
                                                IconContent="{StaticResource ExportToNewAnalysis}"
                                                DescriptionText="Exports selected version to new analysis"/>
                        </Button.ToolTip>
                        <Viewbox>
                            <ContentControl ContentTemplate="{DynamicResource ExportToNewAnalysis}"/>
                        </Viewbox>
                    </Button>
                </ToolBar>
            </ToolBarTray>
            <ListBox ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}">
                <ListBox.ContextMenu>
                    <ContextMenu>
                        <MenuItem Header="Fix version" Command="{Binding AddNewVersionCommand}" ToolTip="Create new version of analysis from selected one">
                            <MenuItem.Icon>
                                <Viewbox Height="16" Width="16">
                                    <ContentControl ContentTemplate="{StaticResource CopyAnalysis}"/>
                                </Viewbox>
                            </MenuItem.Icon>
                        </MenuItem>
                        <MenuItem Header="Restore version" Command="{Binding ReturnToVersionCommand}" ToolTip="Restore to selected version">
                            <MenuItem.Icon>
                                <Viewbox Height="16" Width="16">
                                    <ContentControl ContentTemplate="{StaticResource RestoreAndDelete}"/>
                                </Viewbox>
                            </MenuItem.Icon>
                        </MenuItem>
                        <MenuItem Header="Delete version" Command="{Binding DeleteVersionCommand}" ToolTip="Delete selected version">
                            <MenuItem.Icon>
                                <Viewbox Height="16" Width="16">
                                    <ContentControl ContentTemplate="{StaticResource DeleteEntity}"/>
                                </Viewbox>
                            </MenuItem.Icon>
                        </MenuItem>
                        <MenuItem Header="Export version" Command="{Binding ExportToNewCommand}" ToolTip="Export to new analysis">
                            <MenuItem.Icon>
                                <Viewbox Height="16" Width="16">
                                    <ContentControl ContentTemplate="{StaticResource ExportToNewAnalysis}"/>
                                </Viewbox>
                            </MenuItem.Icon>
                        </MenuItem>
                    </ContextMenu>
                </ListBox.ContextMenu>
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Grid MinWidth="375">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="20"/>
                                <ColumnDefinition Width="150"/>
                                <ColumnDefinition Width="20"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>
                        <TextBlock Grid.Column="1" Text="{Binding DateTime}"/>
                        <TextBox Grid.Column="3" Text="{Binding Comment}"/>
                        </Grid>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </DockPanel>

    </Grid>
</Window>
