-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSetupCollectionRow.xaml
52 lines (52 loc) · 1.99 KB
/
SetupCollectionRow.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
<UserControl x:Class="SetupDiff.SetupCollectionRow"
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"
mc:Ignorable="d"
xmlns:local="clr-namespace:SetupDiff">
<UserControl.Resources>
<local:DiffColourConverter x:Key="DiffColourConverter"/>
<Style x:Key="row" TargetType="StackPanel">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#e2e2e2"/>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="rowBorder" TargetType="Border">
<Setter Property="BorderBrush" Value="Gainsboro"/>
<Setter Property="BorderThickness" Value="0,1,0,0"/>
</Style>
</UserControl.Resources>
<Border Style="{StaticResource rowBorder}">
<StackPanel Orientation="Horizontal" x:Name="sp" Style="{StaticResource row}">
<TextBlock Text="{Binding Header}" Style="{StaticResource cell}"/>
<ItemsControl ItemsSource="{Binding Values}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Value}">
<TextBlock.Style>
<Style TargetType="TextBlock" BasedOn="{StaticResource cell}">
<Setter Property="Foreground">
<Setter.Value>
<MultiBinding Converter="{StaticResource DiffColourConverter}">
<Binding Path="."/>
<Binding Path="DataContext.Values[0]" RelativeSource="{RelativeSource AncestorType=StackPanel}"/>
</MultiBinding>
</Setter.Value>
</Setter>
</Style>
</TextBlock.Style>
</TextBlock>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</Border>
</UserControl>