Advertisement
Hellboyandso

ReversiBoard2

May 24th, 2015
413
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.30 KB | None | 0 0
  1. <UserControl x:Class="ReversiGUI.ReversiBoard"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:ReversiGUI"
  7. mc:Ignorable="d"
  8. d:DesignHeight="150" d:DesignWidth="150">
  9.  
  10. <UserControl.Resources>
  11. <local:PlayerToColorTilesConvertor x:Key="PlayerToColorTilesConvertor" />
  12.  
  13. <Style TargetType="Button" x:Key="MyButton2">
  14. <Setter Property="Template">
  15. <Setter.Value>
  16. <ControlTemplate TargetType="{x:Type Button}">
  17. <Border Background="{TemplateBinding Background}">
  18. <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
  19. </Border>
  20. </ControlTemplate>
  21. </Setter.Value>
  22. </Setter>
  23. <Style.Triggers>
  24. <Trigger Property="IsEnabled" Value="False">
  25. <Setter Property="Background" Value="Transparent"/>
  26. <Setter Property="BorderBrush" Value="Black" />
  27. <Setter Property="BorderThickness" Value="1" />
  28. </Trigger>
  29. </Style.Triggers>
  30. </Style>
  31.  
  32. </UserControl.Resources>
  33. <Viewbox Stretch="Uniform">
  34. <ItemsControl Name="Items" VerticalAlignment="Center" HorizontalAlignment="Center" ItemsSource="{Binding GridViewModel}" Background="Transparent">
  35. <ItemsControl.ItemsPanel>
  36. <ItemsPanelTemplate>
  37. <StackPanel Orientation="Vertical"/>
  38. </ItemsPanelTemplate>
  39. </ItemsControl.ItemsPanel>
  40. <ItemsControl.ItemTemplate>
  41. <DataTemplate>
  42. <ItemsControl ItemsSource="{Binding .}">
  43. <ItemsControl.ItemsPanel>
  44. <ItemsPanelTemplate>
  45. <StackPanel Orientation="Horizontal" />
  46. </ItemsPanelTemplate>
  47. </ItemsControl.ItemsPanel>
  48. <ItemsControl.ItemTemplate>
  49. <DataTemplate>
  50. <Button Style="{StaticResource MyButton2}" Command="{Binding PlaceStoneCommand}" Background="Transparent" BorderBrush="Black" BorderThickness="0.75" Width="30" Height="30">
  51. <Ellipse Width="20" Height="20" Stretch="UniformToFill">
  52. <Ellipse.Fill>
  53. <SolidColorBrush Color="{Binding ColorCell.Value, Converter={StaticResource PlayerToColorTilesConvertor}}"/>
  54. </Ellipse.Fill>
  55. </Ellipse>
  56. </Button>
  57. </DataTemplate>
  58. </ItemsControl.ItemTemplate>
  59. </ItemsControl>
  60. </DataTemplate>
  61. </ItemsControl.ItemTemplate>
  62. </ItemsControl>
  63. </Viewbox>
  64. </UserControl>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement