-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainWindow.xaml
94 lines (94 loc) · 3.64 KB
/
MainWindow.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
<Window
x:Class="GameOfLife.MainWindow"
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:GameOfLife"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="mainWindow"
Title="MainWindow"
Width="760"
Height="810"
mc:Ignorable="d">
<Grid
x:Name="mainGrid"
Width="730"
HorizontalAlignment="Center">
<Button
x:Name="btnStart"
Width="70"
Margin="10,10,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Click="BtnStart_Click"
Content="Start" />
<Button
x:Name="btnCanonPlane"
Width="100"
Height="20"
Margin="95,10,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Click="BtnCanonPlane_Click"
Content="Gosper Canon" />
<ItemsControl
Name="itemsControl"
Width="710"
Height="710"
Margin="10,35,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
BorderBrush="Black"
BorderThickness="1">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid Columns="{Binding Columns}" Rows="{Binding Rows}" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Rectangle
Width="14"
Height="14"
MouseEnter="DisplayCoordinate"
MouseLeftButtonDown="ToggleAlive"
Stroke="DarkGray">
<Rectangle.Style>
<Style TargetType="Rectangle">
<Setter Property="Fill" Value="White" />
<Setter Property="RadiusX" Value="0" />
<Setter Property="RadiusY" Value="0" />
<Style.Triggers>
<DataTrigger Binding="{Binding IsAlive}" Value="True">
<Setter Property="Fill" Value="Black" />
</DataTrigger>
<DataTrigger Binding="{Binding ElementName=chxRoundCell, Path=IsChecked}" Value="True">
<Setter Property="RadiusX" Value="7" />
<Setter Property="RadiusY" Value="7" />
</DataTrigger>
</Style.Triggers>
</Style>
</Rectangle.Style>
</Rectangle>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<TextBlock
x:Name="tblCoordinates"
Width="710"
Height="25"
Margin="10,750,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
FontWeight="Bold"
Foreground="Black"
Text="{Binding RelativeSource={RelativeSource AncestorType=Rectangle}, Path=Tag}"
TextAlignment="Center" />
<CheckBox
x:Name="chxRoundCell"
Margin="640,15,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Content="Round cells" />
</Grid>
</Window>