-
Notifications
You must be signed in to change notification settings - Fork 2
/
FindClosestColor.xaml
125 lines (125 loc) · 4.42 KB
/
FindClosestColor.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
113
114
115
116
117
118
119
120
121
122
123
124
125
<Window x:Class="TerrariaPixelArtHelper.FindClosestColor"
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:local="clr-namespace:TerrariaPixelArtHelper"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="Find Closest Color"
Width="425" Height="275"
MinWidth="425" MinHeight="275"
FocusManager.FocusedElement="{Binding ElementName=lbColors, Mode=OneTime}"
ShowInTaskbar="False" WindowStartupLocation="CenterOwner"
WindowStyle="ToolWindow"
mc:Ignorable="d">
<Window.Background>
<SolidColorBrush Color="{StaticResource {x:Static SystemColors.ControlColorKey}}" />
</Window.Background>
<Window.DataContext>
<local:FindClosestColorViewModel />
</Window.DataContext>
<Grid Margin="5">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="125" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid Width="122" Height="164"
HorizontalAlignment="Center" VerticalAlignment="Top"
UseLayoutRounding="True">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="50" />
<RowDefinition Height="50" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="23" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="23" />
</Grid.ColumnDefinitions>
<TextBlock Grid.ColumnSpan="3"
HorizontalAlignment="Center"
Text="Original:" />
<TextBlock Grid.Row="1" Grid.ColumnSpan="3"
HorizontalAlignment="Center"
Text="{Binding OriginalColorText, Mode=OneWay}" />
<Canvas Grid.Row="2" Grid.RowSpan="2"
Grid.Column="1"
Width="75" Height="100">
<Rectangle Width="75" Height="100"
Panel.ZIndex="2"
Stroke="Black" />
<Line Panel.ZIndex="1"
Stroke="Black" StrokeDashArray="3 1"
StrokeDashOffset="0.5" X1="0.5"
X2="74.5" Y1="50"
Y2="50" />
<Rectangle Canvas.Left="0" Canvas.Top="0"
Width="75" Height="50">
<Rectangle.Fill>
<SolidColorBrush Color="{Binding OriginalColor, Mode=OneWay}" />
</Rectangle.Fill>
</Rectangle>
<Rectangle Canvas.Left="0" Canvas.Top="50"
Width="75" Height="50">
<Rectangle.Fill>
<SolidColorBrush Color="{Binding SelectedColorItem.WallColor, Mode=OneWay}" />
</Rectangle.Fill>
</Rectangle>
</Canvas>
<Border Grid.Row="3"
Width="18" Height="18"
Margin="0,0,5,0" VerticalAlignment="Top"
BorderBrush="Black" BorderThickness="1">
<Image Source="{Binding SelectedColorItem.WallImage, Mode=OneWay}" />
</Border>
<TextBlock Grid.Row="4" Grid.ColumnSpan="3"
HorizontalAlignment="Center"
Text="Selected:" />
<TextBlock Grid.Row="5" Grid.ColumnSpan="3"
HorizontalAlignment="Center"
Text="{Binding SelectedColorText, Mode=OneWay}" />
</Grid>
<ListBox x:Name="lbColors"
Grid.Column="1"
HorizontalContentAlignment="Stretch"
Grid.IsSharedSizeScope="True"
SelectedItem="{Binding SelectedColorItem}">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Margin="0,2">
<Grid.ColumnDefinitions>
<ColumnDefinition SharedSizeGroup="WallName" />
<ColumnDefinition Width="12" />
<ColumnDefinition SharedSizeGroup="Color" />
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding WallName, Mode=OneWay}" />
<Rectangle Grid.Column="1" Margin="5,0">
<Rectangle.Fill>
<SolidColorBrush Color="{StaticResource {x:Static SystemColors.ControlDarkColorKey}}" />
</Rectangle.Fill>
</Rectangle>
<TextBlock Grid.Column="2" Text="{Binding ColorName, Mode=OneWay}" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
<StackPanel Grid.Row="1"
Width="105" Height="20"
Margin="0,5,0,0" HorizontalAlignment="Right"
VerticalAlignment="Center"
Orientation="Horizontal">
<Button Width="50"
Margin="0,0,5,0"
Click="OK_Click" Content="OK"
IsDefault="True" />
<Button Width="50"
Content="Cancel" IsCancel="True" />
</StackPanel>
</Grid>
</Window>