forked from haacked/seegit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommitVertexView.xaml
112 lines (108 loc) · 6.83 KB
/
CommitVertexView.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<UserControl x:Class="SeeGit.Views.CommitVertexView" 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:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:local="clr-namespace:SeeGit"
mc:Ignorable="d" x:Name="View" d:DesignHeight="300" d:DesignWidth="300">
<Grid DataContext="{Binding Model, ElementName=View}">
<AdornerDecorator>
<Border Background="Black" BorderThickness="2" CornerRadius="10,10,10,10">
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<DataTrigger Binding="{Binding OnCurrentBranch}" Value="true">
<Setter Property="BorderBrush" Value="#00CC00" />
</DataTrigger>
<DataTrigger Binding="{Binding OnCurrentBranch}" Value="false">
<Setter Property="BorderBrush" Value="White" />
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<i:Interaction.Behaviors>
<local:CommitAdornerBehavior AdornerVisible="Visible" AdornerMargin="105,10,0,0" DataContext="{Binding}">
<local:CommitAdornerBehavior.AdornerTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Message}" Foreground="White" TextWrapping="Wrap" MaxWidth="250" Visibility="{Binding Path=AdornerMessageVisibility, Converter={StaticResource BooleanToVisibilityConverter}}" />
</StackPanel>
</DataTemplate>
</local:CommitAdornerBehavior.AdornerTemplate>
</local:CommitAdornerBehavior>
<local:CommitAdornerBehavior AdornerVisible="Visible" AdornerMargin="90,-15,0,0" DataContext="{Binding}">
<local:CommitAdornerBehavior.AdornerTemplate>
<DataTemplate>
<ListBox Name="listBox" BorderThickness="0" Background="Transparent"
ItemsSource="{Binding Path=Branches, Mode=OneWay}" Margin="0" Padding="0"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
Visibility="{Binding Path=HasBranches, Converter={StaticResource BooleanToVisibilityConverter}}">
<ListBox.Resources>
<Style TargetType="ListBoxItem">
<Style.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent" />
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent" />
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
</Style.Resources>
</Style>
</ListBox.Resources>
<ListBox.ItemTemplate>
<DataTemplate>
<Border BorderBrush="Black" BorderThickness="1">
<Border.Resources>
<Style x:Key="branch" TargetType="TextBlock">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsHead}" Value="True">
<Setter Property="Background" Value="#00CC00" />
<Setter Property="Foreground" Value="Black" />
</DataTrigger>
<DataTrigger Binding="{Binding Path=Name}" Value="HEAD">
<Setter Property="Background" Value="#FFFFCC" />
<Setter Property="Foreground" Value="Black" />
</DataTrigger>
<DataTrigger Binding="{Binding Path=IsHead}" Value="False">
<Setter Property="Background" Value="#887765" />
<Setter Property="Foreground" Value="Black" />
</DataTrigger>
<DataTrigger Binding="{Binding Path=IsRemote}" Value="True">
<Setter Property="Background" Value="#BFE5FE" />
<Setter Property="Foreground" Value="Black" />
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Resources>
<TextBlock Text="{Binding Name}" Style="{StaticResource branch}" FontSize="8" Padding="2" />
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
</DataTemplate>
</local:CommitAdornerBehavior.AdornerTemplate>
</local:CommitAdornerBehavior>
</i:Interaction.Behaviors>
<Border.Effect>
<DropShadowEffect BlurRadius="2" Color="LightGray" Opacity="0.3" Direction="315" />
</Border.Effect>
<Expander IsExpanded="False" Header="{Binding ShortSha, Mode=OneWay}" Padding="5"
ToolTip="{Binding Message, Mode=OneWay}" Expanded="Expander_Expanded" Collapsed="Expander_Collapsed">
<Expander.Style>
<Style TargetType="{x:Type Expander}">
<Setter Property="Foreground" Value="White" />
<Setter Property="FontFamily" Value="Lucida Console" />
</Style>
</Expander.Style>
<StackPanel Orientation="Vertical">
<TextBlock Text="{Binding Message}" Foreground="White" TextWrapping="Wrap" MaxWidth="150" Visibility="{Binding DescriptionShown, Converter={StaticResource InverseBooleanToVisibilityConverter}}" />
<TextBlock Text="{Binding Description}" Foreground="White" TextWrapping="Wrap" MaxWidth="250" Visibility="{Binding DescriptionShown, Converter={StaticResource BooleanToVisibilityConverter}}" />
<TextBlock Text="{Binding Author}" Foreground="#cccccc" TextWrapping="Wrap" MaxWidth="250" Visibility="{Binding DescriptionShown, Converter={StaticResource BooleanToVisibilityConverter}}" Padding="0,10,0,0" />
<TextBlock Text="{Binding CommitDate}" Foreground="#cccccc" TextWrapping="Wrap" MaxWidth="250" Visibility="{Binding DescriptionShown, Converter={StaticResource BooleanToVisibilityConverter}}" />
</StackPanel>
</Expander>
</Border>
</AdornerDecorator>
</Grid>
</UserControl>