ファイル

425 行
35 KiB
XML

<UserControl x:Class="UndoTree.UndoTreeView"
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:UndoTree"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:pt="clr-namespace:YukkuriMovieMaker.Views.Triggers;assembly=YukkuriMovieMaker.Plugin"
xmlns:pb="clr-namespace:YukkuriMovieMaker.Views.Behaviors;assembly=YukkuriMovieMaker.Plugin"
xmlns:c="clr-namespace:YukkuriMovieMaker.Controls;assembly=YukkuriMovieMaker.Plugin"
xmlns:icons="clr-namespace:YukkuriMovieMaker.Resources.Icons;assembly=YukkuriMovieMaker.Plugin"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="300"
d:DataContext="{d:DesignInstance Type={x:Type local:UndoTreeViewModel}}">
<UserControl.Resources>
<ResourceDictionary>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
<local:DoubleToGridLengthConverter x:Key="DoubleToGridLengthConverter"/>
<ContextMenu x:Key="NodeContextMenu" d:DataContext="{d:DesignInstance Type={x:Type local:UndoTreeNodeViewModel}}">
<MenuItem Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ListBox}, Path=DataContext.JumpCommand}" CommandParameter="{Binding}" Header="{x:Static local:Texts.Jump}" Icon="{DynamicResource {x:Static icons:IconKeys.Restore}}"/>
<MenuItem Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ListBox}, Path=DataContext.CreateBranchCommand}" CommandParameter="{Binding}" Header="{x:Static local:Texts.CreateBranchAtNode}"/>
<Separator/>
<MenuItem Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ListBox}, Path=DataContext.CherryPickCommand}" CommandParameter="{Binding}" Header="{x:Static local:Texts.CherryPick}" Icon="{DynamicResource {x:Static icons:IconKeys.SourceMerge}}"/>
<MenuItem Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ListBox}, Path=DataContext.CherryPickRangeCommand}" CommandParameter="{Binding}" Header="{x:Static local:Texts.CherryPickRange}" Icon="{DynamicResource {x:Static icons:IconKeys.SourceFork}}"/>
<MenuItem Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ListBox}, Path=DataContext.MergeIntoCurrentCommand}" CommandParameter="{Binding}" Header="{x:Static local:Texts.MergeIntoCurrent}" ToolTip="{x:Static local:Texts.MergeIntoCurrentTip}"/>
<Separator/>
<MenuItem Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ListBox}, Path=DataContext.RevertCommand}" CommandParameter="{Binding}" Header="{x:Static local:Texts.Revert}" ToolTip="{x:Static local:Texts.RevertTip}" Icon="{DynamicResource {x:Static icons:IconKeys.Undo}}"/>
<MenuItem Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ListBox}, Path=DataContext.RevertRangeCommand}" CommandParameter="{Binding}" Header="{x:Static local:Texts.RevertRange}" ToolTip="{x:Static local:Texts.RevertRangeTip}"/>
<Separator/>
<MenuItem Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ListBox}, Path=DataContext.EditTagCommand}" CommandParameter="{Binding}" Header="{x:Static local:Texts.TagNode}" InputGestureText="F2"/>
<MenuItem Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ListBox}, Path=DataContext.ClearTagCommand}" CommandParameter="{Binding}" Header="{x:Static local:Texts.ClearTag}"/>
<Separator/>
<MenuItem Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ListBox}, Path=DataContext.SetCompareBaseCommand}" CommandParameter="{Binding}" Header="{x:Static local:Texts.SetCompareBase}" ToolTip="{x:Static local:Texts.SetCompareBaseTip}"/>
<MenuItem Command="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ListBox}, Path=DataContext.ClearCompareBaseCommand}" Header="{x:Static local:Texts.ClearCompareBase}"/>
</ContextMenu>
<Style x:Key="ToolBarButtonStyle" TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
<Setter Property="Padding" Value="3"/>
<Setter Property="Width" Value="26"/>
</Style>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition MinHeight="{x:Static local:UndoTreeLayout.MinTreeHeight}"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="{Binding DetailsHeight, Converter={StaticResource DoubleToGridLengthConverter}, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
<RowDefinition.Style>
<Style TargetType="RowDefinition">
<Setter Property="MinHeight" Value="{x:Static local:UndoTreeLayout.MinDetailsHeight}"/>
<Setter Property="MaxHeight" Value="{x:Static local:UndoTreeLayout.MaxDetailsHeight}"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsDetailsVisible}" Value="False">
<Setter Property="MaxHeight" Value="0"/>
<Setter Property="MinHeight" Value="0"/>
</DataTrigger>
</Style.Triggers>
</Style>
</RowDefinition.Style>
</RowDefinition>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Button Grid.Column="0" Content="{DynamicResource {x:Static icons:IconKeys.Undo}}" Command="{Binding UndoCommand}" ToolTip="{x:Static local:Texts.Undo}" Style="{StaticResource ToolBarButtonStyle}"/>
<Button Grid.Column="1" Content="{DynamicResource {x:Static icons:IconKeys.Redo}}" Command="{Binding RedoCommand}" ToolTip="{x:Static local:Texts.Redo}" Style="{StaticResource ToolBarButtonStyle}"/>
<Button Grid.Column="2" Content="{DynamicResource {x:Static icons:IconKeys.CrosshairsGps}}" Command="{Binding GoToCurrentCommand}" ToolTip="{x:Static local:Texts.GoToCurrent}" Style="{StaticResource ToolBarButtonStyle}"/>
<Button Grid.Column="3" Content="{DynamicResource {x:Static icons:IconKeys.ExpandAll}}" Command="{Binding ExpandAllCommand}" ToolTip="{x:Static local:Texts.ExpandAll}" Style="{StaticResource ToolBarButtonStyle}"/>
<Button Grid.Column="4" Content="{DynamicResource {x:Static icons:IconKeys.CollapseAll}}" Command="{Binding CollapseAllCommand}" ToolTip="{x:Static local:Texts.CollapseAll}" Style="{StaticResource ToolBarButtonStyle}"/>
<TextBox x:Name="filterTextBox" Grid.Column="5" Padding="3,0,3,0" VerticalContentAlignment="Center"
Text="{Binding Filter.SearchText, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Delay={x:Static local:UndoTreeLayout.FilterDelayMilliseconds}}"/>
<TextBlock Grid.Column="5" Text="{x:Static local:Texts.Filter}" Foreground="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" VerticalAlignment="Center" Margin="6,0,3,0" IsHitTestVisible="False">
<TextBlock.Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Text, ElementName=filterTextBox}" Value="">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<c:DropDownButton Grid.Column="6" Content="{DynamicResource {x:Static icons:IconKeys.Menu}}">
<c:DropDownButton.Style>
<Style TargetType="{x:Type c:DropDownButton}" BasedOn="{StaticResource {x:Type ToggleButton}}">
<Setter Property="Padding" Value="3"/>
<Setter Property="Width" Value="26"/>
</Style>
</c:DropDownButton.Style>
<c:DropDownButton.ContextMenu>
<ContextMenu>
<MenuItem Header="{x:Static local:Texts.FollowCurrent}" IsCheckable="True" IsChecked="{Binding Source={x:Static local:UndoTreeSettings.Default},Path=FollowCurrent,Mode=TwoWay}"/>
<MenuItem Header="{x:Static local:Texts.ShowTime}" IsCheckable="True" IsChecked="{Binding Source={x:Static local:UndoTreeSettings.Default},Path=ShowTime,Mode=TwoWay}"/>
<MenuItem Header="{x:Static local:Texts.Details}" IsCheckable="True" IsChecked="{Binding IsDetailsVisible,Mode=TwoWay}"/>
<Separator/>
<MenuItem Header="{x:Static local:Texts.SelectionOnly}" IsCheckable="True" IsChecked="{Binding Source={x:Static local:UndoTreeSettings.Default},Path=SelectionOnly,Mode=TwoWay}"/>
<MenuItem Header="{x:Static local:Texts.FoldRuns}" IsCheckable="True" IsChecked="{Binding Source={x:Static local:UndoTreeSettings.Default},Path=FoldRuns,Mode=TwoWay}"/>
<MenuItem Header="{x:Static local:Texts.LinkTimeline}" IsCheckable="True" IsChecked="{Binding Source={x:Static local:UndoTreeSettings.Default},Path=LinkTimeline,Mode=TwoWay}"/>
<MenuItem Header="{x:Static local:Texts.DiffMode}" ToolTip="{x:Static local:Texts.DiffModeTip}" IsCheckable="True" IsChecked="{Binding IsDiffMode,Mode=TwoWay}"/>
<MenuItem Header="{x:Static local:Texts.GoToSaved}" ToolTip="{x:Static local:Texts.GoToSavedTip}" Command="{Binding DataContext.GoToSavedCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>
<MenuItem Header="{x:Static local:Texts.ShowPrevious}" ToolTip="{x:Static local:Texts.ShowPreviousTip}" IsCheckable="True" IsEnabled="{Binding HasRecord}" IsChecked="{Binding IsShowingRecord,Mode=TwoWay}"/>
<Separator/>
<MenuItem Header="{x:Static local:Texts.MoveToPreviousCreated}" Command="{Binding DataContext.MoveCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" CommandParameter="PreviousCreated"/>
<MenuItem Header="{x:Static local:Texts.MoveToNextCreated}" Command="{Binding DataContext.MoveCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" CommandParameter="NextCreated"/>
<MenuItem Header="{x:Static local:Texts.MoveToPreviousBranch}" Command="{Binding DataContext.MoveCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" CommandParameter="PreviousBranch"/>
<MenuItem Header="{x:Static local:Texts.MoveToNextBranch}" Command="{Binding DataContext.MoveCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" CommandParameter="NextBranch"/>
<Separator/>
<MenuItem Header="{x:Static local:Texts.CreateBranch}" Command="{Binding DataContext.CreateBranchCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>
<MenuItem Header="{x:Static local:Texts.SwitchBranch}" ItemsSource="{Binding BranchChoices}" IsEnabled="{Binding HasNamedBranches}">
<MenuItem.ItemContainerStyle>
<Style TargetType="MenuItem" BasedOn="{StaticResource {x:Type MenuItem}}">
<Setter Property="Header" Value="{Binding Name}"/>
<Setter Property="IsChecked" Value="{Binding IsActive, Mode=OneWay}"/>
<Setter Property="Command" Value="{Binding DataContext.SwitchBranchCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>
<Setter Property="CommandParameter" Value="{Binding}"/>
</Style>
</MenuItem.ItemContainerStyle>
</MenuItem>
<MenuItem Header="{x:Static local:Texts.RestoreBranches}" ItemsSource="{Binding RecordedBranches}" Visibility="{Binding HasRecordedBranches, Converter={StaticResource BooleanToVisibilityConverter}}">
<MenuItem.ItemContainerStyle>
<Style TargetType="MenuItem" BasedOn="{StaticResource {x:Type MenuItem}}">
<Setter Property="Header" Value="{Binding Name}"/>
<Setter Property="ToolTip" Value="{Binding RestoreHint}"/>
<Setter Property="Command" Value="{Binding DataContext.RestoreBranchCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>
<Setter Property="CommandParameter" Value="{Binding}"/>
</Style>
</MenuItem.ItemContainerStyle>
</MenuItem>
<Separator/>
<MenuItem Header="{x:Static local:Texts.CopyHistory}" Command="{Binding DataContext.CopyHistoryCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>
<MenuItem Header="{x:Static local:Texts.ExportHistory}" Command="{Binding DataContext.ExportHistoryCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"/>
<Separator/>
<MenuItem Header="{x:Static local:Texts.ConflictPolicy}" ToolTip="{x:Static local:Texts.ConflictPolicyTip}">
<MenuItem Header="{x:Static local:Texts.ConflictSkip}" IsCheckable="True" IsChecked="{Binding IsConflictSkip, Mode=OneWay}" Command="{Binding DataContext.SwitchConflictPolicyCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" CommandParameter="Skip"/>
<MenuItem Header="{x:Static local:Texts.ConflictApply}" IsCheckable="True" IsChecked="{Binding IsConflictApply, Mode=OneWay}" Command="{Binding DataContext.SwitchConflictPolicyCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" CommandParameter="Apply"/>
<MenuItem Header="{x:Static local:Texts.ConflictOffset}" IsCheckable="True" IsChecked="{Binding IsConflictOffset, Mode=OneWay}" Command="{Binding DataContext.SwitchConflictPolicyCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" CommandParameter="Offset"/>
</MenuItem>
<MenuItem Header="{x:Static local:Texts.PreferReplay}" ToolTip="{x:Static local:Texts.PreferReplayTip}" IsCheckable="True" IsChecked="{Binding Source={x:Static local:UndoTreeSettings.Default},Path=PreferReplay,Mode=TwoWay}"/>
<Separator/>
<MenuItem Header="{x:Static local:Texts.DropBranches}" Command="{Binding DataContext.DropBranchesCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" Icon="{DynamicResource {x:Static icons:IconKeys.Delete}}"/>
</ContextMenu>
</c:DropDownButton.ContextMenu>
</c:DropDownButton>
</Grid>
<Grid Grid.Row="1" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" ToolTip="{x:Static local:Texts.BranchTip}">
<Grid.Style>
<Style TargetType="Grid">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding HasActiveBranch}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Grid.Style>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{x:Static local:Texts.BranchTitle}" Foreground="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" Padding="4,0,4,0" VerticalAlignment="Center"/>
<TextBox Grid.Column="1" Height="26" Padding="3,0,3,0" VerticalContentAlignment="Center" Text="{Binding ActiveBranchName, Mode=TwoWay}" ToolTip="{x:Static local:Texts.BranchName}">
<i:Interaction.Behaviors>
<local:CommitOnEnterBehavior/>
</i:Interaction.Behaviors>
</TextBox>
<Button Grid.Column="2" Height="26" MinWidth="80" VerticalAlignment="Center" Content="{x:Static local:Texts.LeaveBranch}" ToolTip="{x:Static local:Texts.LeaveBranchTip}" Command="{Binding SwitchBranchCommand}"/>
<Button Grid.Column="3" Width="26" Height="26" Padding="3" VerticalAlignment="Center" Content="{DynamicResource {x:Static icons:IconKeys.SourceMerge}}" ToolTip="{x:Static local:Texts.MergeBranch}" Command="{Binding MergeBranchCommand}"/>
<Button Grid.Column="4" Width="26" Height="26" Padding="3" VerticalAlignment="Center" Content="{DynamicResource {x:Static icons:IconKeys.ArrowULeftTop}}" ToolTip="{x:Static local:Texts.CloseBranchAtBase}" Command="{Binding CloseBranchAtBaseCommand}"/>
</Grid>
<Grid Grid.Row="2" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}">
<Grid.Style>
<Style TargetType="Grid">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding HasRecovery}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Grid.Style>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="{x:Static local:Texts.RecoveryMessage}" TextWrapping="Wrap" Padding="4" VerticalAlignment="Center"/>
<Button Grid.Column="1" Height="26" MinWidth="80" VerticalAlignment="Center" Content="{x:Static local:Texts.RecoveryRestore}" Command="{Binding RecoverCommand}"/>
<Button Grid.Column="2" Width="26" Height="26" Padding="3" VerticalAlignment="Center" Content="{DynamicResource {x:Static icons:IconKeys.Close}}" ToolTip="{x:Static local:Texts.RecoveryDismiss}" Command="{Binding DismissRecoveryCommand}"/>
</Grid>
<TextBlock Grid.Row="2" Text="{x:Static local:Texts.Unsupported}" TextWrapping="Wrap" Foreground="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}">
<TextBlock.Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsSupported}" Value="False">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<ListBox Grid.Row="3" ItemsSource="{Binding Items}" BorderThickness="0" Background="Transparent" SelectionMode="Single"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
VirtualizingPanel.IsVirtualizing="True" VirtualizingPanel.ScrollUnit="Pixel" ScrollViewer.CanContentScroll="True">
<i:Interaction.Behaviors>
<local:ScrollSelectedItemIntoViewBehavior/>
</i:Interaction.Behaviors>
<ListBox.InputBindings>
<KeyBinding Key="Return" Command="{Binding JumpCommand}"/>
<KeyBinding Key="F2" Command="{Binding EditTagCommand}"/>
</ListBox.InputBindings>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
<Setter Property="Padding" Value="{x:Static local:UndoTreeLayout.RowInset}"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}"/>
<Setter Property="ContextMenu" Value="{StaticResource NodeContextMenu}"/>
<Setter Property="pb:StyleBehaviorCollection.StyleBehaviors">
<Setter.Value>
<pb:StyleBehaviorCollection>
<local:RightClickSelectionBehavior/>
</pb:StyleBehaviorCollection>
</Setter.Value>
</Setter>
<Setter Property="pt:StyleTriggerCollection.StyleTriggers">
<Setter.Value>
<pt:StyleTriggerCollection>
<i:EventTrigger EventName="MouseDoubleClick">
<i:InvokeCommandAction Command="{Binding DataContext.JumpCommand, RelativeSource={RelativeSource AncestorType=ListBox}}" CommandParameter="{Binding}"/>
</i:EventTrigger>
</pt:StyleTriggerCollection>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Margin="{Binding Margin}" MinHeight="{x:Static local:UndoTreeLayout.RowContentHeight}" Background="Transparent" Opacity="{Binding Opacity}" ToolTip="{Binding RestoreHint}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<ToggleButton Grid.Column="0" Width="{x:Static local:UndoTreeLayout.IndentWidth}" Height="{x:Static local:UndoTreeLayout.IndentWidth}" Margin="0,0,4,0" IsChecked="{Binding Toggle.IsExpanded, Mode=TwoWay}">
<ToggleButton.Style>
<Style TargetType="ToggleButton">
<Setter Property="Visibility" Value="Hidden"/>
<Style.Triggers>
<DataTrigger Binding="{Binding CanExpand}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</ToggleButton.Style>
<ToggleButton.Template>
<ControlTemplate TargetType="ToggleButton">
<Grid Background="Transparent">
<ContentControl x:Name="Icon" Content="{DynamicResource {x:Static icons:IconKeys.ChevronRight}}" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Width="12" Height="12"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="Icon" Property="Content" Value="{DynamicResource {x:Static icons:IconKeys.ChevronDown}}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</ToggleButton.Template>
</ToggleButton>
<Border Grid.Column="1" Width="9" Height="9" CornerRadius="5" BorderThickness="1" Margin="0,0,6,0" VerticalAlignment="Center"
BorderBrush="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}">
<Border.Style>
<Style TargetType="Border">
<Setter Property="Background" Value="Transparent"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsCurrent}" Value="True">
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
<Setter Property="BorderBrush" Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsOnPath}" Value="True">
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
</Border>
<TextBox Grid.Column="2" Text="{Binding EditingTag, UpdateSourceTrigger=PropertyChanged}" Padding="0" BorderThickness="1" VerticalContentAlignment="Center" VerticalAlignment="Stretch">
<TextBox.Style>
<Style TargetType="TextBox" BasedOn="{StaticResource {x:Type TextBox}}">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding IsEditingTag}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBox.Style>
<TextBox.InputBindings>
<KeyBinding Key="Return" Command="{Binding DataContext.CommitTagCommand, RelativeSource={RelativeSource AncestorType=ListBox}}" CommandParameter="{Binding}"/>
<KeyBinding Key="Escape" Command="{Binding DataContext.CancelTagCommand, RelativeSource={RelativeSource AncestorType=ListBox}}" CommandParameter="{Binding}"/>
</TextBox.InputBindings>
<i:Interaction.Behaviors>
<local:FocusWhenVisibleBehavior/>
</i:Interaction.Behaviors>
<i:Interaction.Triggers>
<i:EventTrigger EventName="LostKeyboardFocus">
<i:InvokeCommandAction Command="{Binding DataContext.CommitTagCommand, RelativeSource={RelativeSource AncestorType=ListBox}}" CommandParameter="{Binding}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</TextBox>
<TextBlock Grid.Column="2" Text="{Binding DisplayText}" TextTrimming="CharacterEllipsis" VerticalAlignment="Center">
<TextBlock.Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsCurrent}" Value="True">
<Setter Property="FontWeight" Value="Bold"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsEditingTag}" Value="True">
<Setter Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<ContentControl Grid.Column="3" Content="{DynamicResource {x:Static icons:IconKeys.SourceFork}}" Foreground="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" Width="12" Height="12" ToolTip="{x:Static local:Texts.SideBranches}">
<ContentControl.Style>
<Style TargetType="ContentControl">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding HasSideBranches}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
</ContentControl>
<TextBlock Grid.Column="4" Text="{Binding TimeText}" Foreground="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" VerticalAlignment="Center">
<TextBlock.Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding Source={x:Static local:UndoTreeSettings.Default},Path=ShowTime}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<GridSplitter Grid.Row="4" Height="6" HorizontalAlignment="Stretch" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Cursor="SizeNS" ResizeDirection="Rows"
Visibility="{Binding IsDetailsVisible, Converter={StaticResource BooleanToVisibilityConverter}}"/>
<Grid Grid.Row="5" Visibility="{Binding IsDetailsVisible, Converter={StaticResource BooleanToVisibilityConverter}}">
<ListBox ItemsSource="{Binding Details}" BorderThickness="0" Background="Transparent" Focusable="False" SelectionMode="Single"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
<Setter Property="Padding" Value="4,1"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="Focusable" Value="False"/>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Margin="{Binding Margin}" Text="{Binding Display}" ToolTip="{Binding Display}" TextTrimming="CharacterEllipsis" VerticalAlignment="Center">
<TextBlock.Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
<Style.Triggers>
<DataTrigger Binding="{Binding IsGroup}" Value="True">
<Setter Property="FontWeight" Value="SemiBold"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<TextBlock Text="{x:Static local:Texts.DetailsEmpty}" Foreground="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" IsHitTestVisible="False" TextWrapping="Wrap">
<TextBlock.Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding HasNoDetails}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
<StackPanel Grid.Row="6">
<TextBlock Text="{Binding ResultText}" TextWrapping="Wrap" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}">
<TextBlock.Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource {x:Type TextBlock}}">
<Setter Property="Visibility" Value="Collapsed"/>
<Style.Triggers>
<DataTrigger Binding="{Binding HasResult}" Value="True">
<Setter Property="Visibility" Value="Visible"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Text="{Binding StatusText}" ToolTip="{Binding StatusToolTip}" AutomationProperties.HelpText="{Binding StatusToolTip}" Foreground="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" TextTrimming="CharacterEllipsis"/>
</StackPanel>
</Grid>
</UserControl>