<!-- Window1.xaml -->
<Window
  x:Class="TicTacToe.Window1"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:local="clr-namespace:TicTacToe"
  Title="TicTacToe"
  Height="350"
  Width="350">
  <Window.Resources>
    <Style TargetType="{x:Type Button}">
      <Setter Property="Background" Value="White" />
      <Setter Property="HorizontalContentAlignment" Value="Stretch" />
      <Setter Property="VerticalContentAlignment" Value="Stretch" />
      <Setter Property="Padding" Value="8" />
      <Style.Triggers>
        <Trigger Property="Content" Value="{x:Null}" >
          <Setter Property="ToolTip" Value="click to move here" />
        </Trigger>
        <!--<Trigger Property="IsFocused" Value="True" >
      <Setter Property="ToolTip" Value="click or spacebar to move here" />
    </Trigger>-->
        <MultiTrigger>
          <MultiTrigger.Conditions>
            <Condition Property="IsFocused" Value="True" />
            <Condition Property="Content" Value="{x:Null}" />
          </MultiTrigger.Conditions>
          <Setter Property="ToolTip" Value="click or spacebar to move here" />
        </MultiTrigger>
        <!--<EventTrigger RoutedEvent="Click">
      <BeginStoryboard>
        <Storyboard>
          <DoubleAnimation Storyboard.TargetProperty="Opacity"
                           From="0" To="1" Duration="0:0:2" />
        </Storyboard>
      </BeginStoryboard>
    </EventTrigger>-->
      </Style.Triggers>
    </Style>
    <Style x:Key="StatusTextStyle" TargetType="{x:Type TextBlock}">
      <Setter Property="FontSize" Value="32pt" />
      <Setter Property="FontWeight" Value="Thin" />
      <Setter Property="Foreground" Value="White" />
      <Setter Property="HorizontalAlignment" Value="Center" />
    </Style>
    <Style x:Key="CellTextStyle" TargetType="{x:Type TextBlock}">
      <Setter Property="FontSize" Value="32pt" />
      <Setter Property="FontWeight" Value="Bold" />
      <Setter Property="VerticalAlignment" Value="Center" />
      <Setter Property="HorizontalAlignment" Value="Center" />
      <Style.Triggers>
        <DataTrigger Binding="{Binding Path=PlayerName}" Value="X">
          <Setter Property="Foreground" Value="Red" />
        </DataTrigger>
        <DataTrigger Binding="{Binding Path=PlayerName}" Value="O">
          <Setter Property="Foreground" Value="Green" />
        </DataTrigger>
      </Style.Triggers>
    </Style>
    <Style x:Key="MoveNumberStyle" TargetType="{x:Type TextBlock}">
      <Setter Property="FontSize" Value="16pt" />
      <Setter Property="FontStyle" Value="Italic" />
      <Setter Property="VerticalAlignment" Value="Bottom" />
      <Setter Property="HorizontalAlignment" Value="Right" />
      <Style.Triggers>
        <MultiDataTrigger>
          <MultiDataTrigger.Conditions>
            <Condition Binding="{Binding Path=PlayerName}" Value="X" />
            <Condition Binding="{Binding Path=IsPartOfWin}" Value="True" />
          </MultiDataTrigger.Conditions>
          <Setter Property="BitmapEffect">
            <Setter.Value>
              <OuterGlowBitmapEffect GlowColor="Red" GlowSize="10" />
            </Setter.Value>
          </Setter>
        </MultiDataTrigger>
        <MultiDataTrigger>
          <MultiDataTrigger.Conditions>
            <Condition Binding="{Binding Path=PlayerName}" Value="O" />
            <Condition Binding="{Binding Path=IsPartOfWin}" Value="True" />
          </MultiDataTrigger.Conditions>
          <Setter Property="BitmapEffect">
            <Setter.Value>
              <OuterGlowBitmapEffect GlowColor="Green" GlowSize="10" />
            </Setter.Value>
          </Setter>
        </MultiDataTrigger>
      </Style.Triggers>
    </Style>
    <DataTemplate DataType="{x:Type local:PlayerMove}">
      <Grid>
        <TextBlock
          Text="{Binding Path=PlayerName}"
          Style="{StaticResource CellTextStyle}" />
        <TextBlock
          Text="{Binding Path=MoveNumber}"
          Style="{StaticResource MoveNumberStyle}" />
      </Grid>
    </DataTemplate>
  </Window.Resources>
  <Grid Background="Black">
    <Grid.RowDefinitions>
      <RowDefinition />
      <RowDefinition />
      <RowDefinition />
      <RowDefinition Height="Auto" />
    </Grid.RowDefinitions>
    <Grid.ColumnDefinitions>
      <ColumnDefinition />
      <ColumnDefinition />
      <ColumnDefinition />
    </Grid.ColumnDefinitions>
    <Button Margin="0,0,2,2" Grid.Row="0" Grid.Column="0" Name="cell00" />
    <Button Margin="2,0,2,2" Grid.Row="0" Grid.Column="1" Name="cell01" />
    <Button Margin="2,0,0,2" Grid.Row="0" Grid.Column="2" Name="cell02" />
    <Button Margin="0,2,2,2" Grid.Row="1" Grid.Column="0" Name="cell10" />
    <Button Margin="2,2,2,2" Grid.Row="1" Grid.Column="1" Name="cell11" />
    <Button Margin="2,2,0,2" Grid.Row="1" Grid.Column="2" Name="cell12" />
    <Button Margin="0,2,2,0" Grid.Row="2" Grid.Column="0" Name="cell20" />
    <Button Margin="2,2,2,0" Grid.Row="2" Grid.Column="1" Name="cell21" />
    <Button Margin="2,2,0,0" Grid.Row="2" Grid.Column="2" Name="cell22" />
    <TextBlock Style="{StaticResource StatusTextStyle}" FontWeight="Normal" Foreground="White" Grid.Row="3" Grid.ColumnSpan="3" Name="statusTextBlock" />
  </Grid>
</Window>
