b1 .. b9 – назви кнопок для перевірки на виграш
Draw() – нічия
Clear() – очистити
((Button)sender).Content = "X";
<Window x:Class="WpfApp7.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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp7"
mc:Ignorable="d"
Title="Tic Tac Toe" Height="450" Width="450">
<Grid Background="#FF62C8DC">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Button Grid.Row="0" Grid.Column="0" Content="X" FontSize="70" Margin="5,5,5,5" Background="#FFF8FFB5" />
<Button Grid.Row="0" Grid.Column="1" Content="X" FontSize="70" Margin="5,5,5,5" Background="#FFF8FFB5" />
<Button Grid.Row="0" Grid.Column="2" Content="X" FontSize="70" Margin="5,5,5,5" Background="#FFF8FFB5" />
<Button Grid.Row="1" Grid.Column="0" Content="X" FontSize="70" Margin="5,5,5,5" Background="#FFF8FFB5" />
<Button Grid.Row="1" Grid.Column="1" Content="X" FontSize="70" Margin="5,5,5,5" Background="#FFF8FFB5" />
<Button Grid.Row="1" Grid.Column="2" Content="X" FontSize="70" Margin="5,5,5,5" Background="#FFF8FFB5" />
<Button Grid.Row="2" Grid.Column="0" Content="X" FontSize="70" Margin="5,5,5,5" Background="#FFF8FFB5" />
<Button Grid.Row="2" Grid.Column="1" Content="X" FontSize="70" Margin="5,5,5,5" Background="#FFF8FFB5" />
<Button Grid.Row="2" Grid.Column="2" Content="X" FontSize="70" Margin="5,5,5,5" Background="#FFF8FFB5" />
</Grid>
</Window>