mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
117 lines
6 KiB
Text
117 lines
6 KiB
Text
|
<UserControl x:Class="SourceGit.Views.Widgets.PageTabBar"
|
||
|
x:Name="me"
|
||
|
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:controls="clr-namespace:SourceGit.Views.Controls"
|
||
|
mc:Ignorable="d"
|
||
|
d:DesignHeight="28" d:DesignWidth="800">
|
||
|
<Grid>
|
||
|
<Grid.ColumnDefinitions>
|
||
|
<ColumnDefinition Width="Auto"/>
|
||
|
<ColumnDefinition Width="*"/>
|
||
|
<ColumnDefinition Width="Auto"/>
|
||
|
</Grid.ColumnDefinitions>
|
||
|
|
||
|
<!-- Left Scroller -->
|
||
|
<controls:IconButton
|
||
|
Grid.Column="0"
|
||
|
x:Name="leftScroller"
|
||
|
Click="ScrollLeft"
|
||
|
Width="18" Padding="5"
|
||
|
HoverBackground="{StaticResource Brush.Accent1}"
|
||
|
BorderBrush="{StaticResource Brush.Border0}"
|
||
|
BorderThickness="0,0,1,0"
|
||
|
Icon="{StaticResource Icon.ScrollLeft}"
|
||
|
WindowChrome.IsHitTestVisibleInChrome="True"
|
||
|
Visibility="Collapsed"/>
|
||
|
|
||
|
<!-- Tabs -->
|
||
|
<ScrollViewer
|
||
|
Grid.Column="1"
|
||
|
x:Name="scroller"
|
||
|
HorizontalScrollBarVisibility="Hidden"
|
||
|
VerticalScrollBarVisibility="Disabled">
|
||
|
<StackPanel Orientation="Horizontal" SizeChanged="CalcScrollerVisibilty">
|
||
|
<ListBox
|
||
|
x:Name="container"
|
||
|
ItemsSource="{Binding ElementName=me, Path=Tabs}"
|
||
|
WindowChrome.IsHitTestVisibleInChrome="True"
|
||
|
SelectionChanged="SelectionChanged">
|
||
|
|
||
|
<ListBox.ItemsPanel>
|
||
|
<ItemsPanelTemplate>
|
||
|
<VirtualizingStackPanel Orientation="Horizontal"/>
|
||
|
</ItemsPanelTemplate>
|
||
|
</ListBox.ItemsPanel>
|
||
|
|
||
|
<ListBox.ItemContainerStyle>
|
||
|
<Style TargetType="{x:Type ListBoxItem}">
|
||
|
<Setter Property="AllowDrop" Value="True"/>
|
||
|
<Setter Property="Template">
|
||
|
<Setter.Value>
|
||
|
<ControlTemplate TargetType="{x:Type ListBoxItem}">
|
||
|
<Border x:Name="Border" Background="Transparent" BorderBrush="{StaticResource Brush.Border0}" BorderThickness="0,0,1,0">
|
||
|
<StackPanel Margin="8,0" x:Name="Contents" Orientation="Horizontal" Opacity=".5">
|
||
|
<ContentPresenter VerticalAlignment="Center" Content="{Binding Control}"/>
|
||
|
|
||
|
<controls:IconButton
|
||
|
Click="CloseTab"
|
||
|
Width="16" Height="16"
|
||
|
Margin="4,0,0,0" Padding="4"
|
||
|
ToolTip="{StaticResource Text.Close}"
|
||
|
Icon="{StaticResource Icon.Close}"
|
||
|
HoverBackground="{StaticResource Brush.NewPageHover}"/>
|
||
|
</StackPanel>
|
||
|
</Border>
|
||
|
|
||
|
<ControlTemplate.Triggers>
|
||
|
<Trigger Property="IsSelected" Value="True">
|
||
|
<Setter TargetName="Border" Property="Background" Value="{StaticResource Brush.Window}"/>
|
||
|
<Setter TargetName="Contents" Property="Opacity" Value="1"/>
|
||
|
</Trigger>
|
||
|
<MultiTrigger>
|
||
|
<MultiTrigger.Conditions>
|
||
|
<Condition Property="IsSelected" Value="False"/>
|
||
|
<Condition Property="IsMouseOver" Value="True"/>
|
||
|
</MultiTrigger.Conditions>
|
||
|
<Setter TargetName="Contents" Property="Opacity" Value=".85"/>
|
||
|
</MultiTrigger>
|
||
|
</ControlTemplate.Triggers>
|
||
|
</ControlTemplate>
|
||
|
</Setter.Value>
|
||
|
</Setter>
|
||
|
|
||
|
<EventSetter Event="MouseMove" Handler="OnMouseMove"/>
|
||
|
<EventSetter Event="Drop" Handler="OnDrop"/>
|
||
|
</Style>
|
||
|
</ListBox.ItemContainerStyle>
|
||
|
</ListBox>
|
||
|
|
||
|
<controls:IconButton
|
||
|
Width="20" Height="20"
|
||
|
Margin="4,0" Padding="4"
|
||
|
Icon="{StaticResource Icon.NewTab}"
|
||
|
HoverBackground="{StaticResource Brush.NewPageHover}"
|
||
|
ToolTip="{StaticResource Text.PageSwitcher.New}"
|
||
|
Click="NewTab"
|
||
|
WindowChrome.IsHitTestVisibleInChrome="True"/>
|
||
|
</StackPanel>
|
||
|
</ScrollViewer>
|
||
|
|
||
|
<!-- Right Scroller -->
|
||
|
<controls:IconButton
|
||
|
Grid.Column="2"
|
||
|
x:Name="rightScroller"
|
||
|
Click="ScrollRight"
|
||
|
Width="18" Padding="5"
|
||
|
HoverBackground="{StaticResource Brush.Accent1}"
|
||
|
BorderBrush="{StaticResource Brush.Border0}"
|
||
|
BorderThickness="1,0"
|
||
|
Icon="{StaticResource Icon.ScrollRight}"
|
||
|
WindowChrome.IsHitTestVisibleInChrome="True"
|
||
|
Visibility="Collapsed"/>
|
||
|
</Grid>
|
||
|
</UserControl>
|