Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <UserControl x:Class="ReversiGUI.ReversiBoard"
- 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"
- xmlns:local="clr-namespace:ReversiGUI"
- mc:Ignorable="d"
- d:DesignHeight="150" d:DesignWidth="150">
- <UserControl.Resources>
- <local:PlayerToColorTilesConvertor x:Key="PlayerToColorTilesConvertor" />
- <Style TargetType="Button" x:Key="MyButton2">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type Button}">
- <Border Background="{TemplateBinding Background}">
- <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
- </Border>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- <Style.Triggers>
- <Trigger Property="IsEnabled" Value="False">
- <Setter Property="Background" Value="Transparent"/>
- <Setter Property="BorderBrush" Value="Black" />
- <Setter Property="BorderThickness" Value="1" />
- </Trigger>
- </Style.Triggers>
- </Style>
- </UserControl.Resources>
- <Viewbox Stretch="Uniform">
- <ItemsControl Name="Items" VerticalAlignment="Center" HorizontalAlignment="Center" ItemsSource="{Binding GridViewModel}" Background="Transparent">
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <StackPanel Orientation="Vertical"/>
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <ItemsControl ItemsSource="{Binding .}">
- <ItemsControl.ItemsPanel>
- <ItemsPanelTemplate>
- <StackPanel Orientation="Horizontal" />
- </ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- <ItemsControl.ItemTemplate>
- <DataTemplate>
- <Button Style="{StaticResource MyButton2}" Command="{Binding PlaceStoneCommand}" Background="Transparent" BorderBrush="Black" BorderThickness="0.75" Width="30" Height="30">
- <Ellipse Width="20" Height="20" Stretch="UniformToFill">
- <Ellipse.Fill>
- <SolidColorBrush Color="{Binding ColorCell.Value, Converter={StaticResource PlayerToColorTilesConvertor}}"/>
- </Ellipse.Fill>
- </Ellipse>
- </Button>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- </DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
- </Viewbox>
- </UserControl>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement