Hello,
For two days i trying to convert the following code to analogue in WinRT, but I can't. The WinRT does not have DrawingImage, so I tried to proceed by analogy with the Path or Polyline, but I failed.
I would be very grateful forYour help.
<Window x:Class="HexagonGridTest.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:HexagonGridTest"
Title="Window1" Height="741.836" Width="697.351" removed="#FF232323">
<Window.Resources>
<DrawingImage x:Key="HexagonImage">
<DrawingImage.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="#11AA11"
Geometry="M 250,0 L 750,0 L 1000,433 L 750,866 L 250,866 L 0,433 Z">
<GeometryDrawing.Pen>
<Pen Brush="Black" Thickness="10" LineJoin="Round"/>
</GeometryDrawing.Pen>
</GeometryDrawing>
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="HexagonHoverImage">
<DrawingImage.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="Khaki"
Geometry="M 250,0 L 750,0 L 1000,433 L 750,866 L 250,866 L 0,433 Z">
<GeometryDrawing.Pen>
<Pen Brush="Black" Thickness="10" LineJoin="Round"/>
</GeometryDrawing.Pen>
</GeometryDrawing>
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<DrawingImage x:Key="HexagonPressedImage">
<DrawingImage.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="Orange"
Geometry="M 250,0 L 750,0 L 1000,433 L 750,866 L 250,866 L 0,433 Z">
<GeometryDrawing.Pen>
<Pen Brush="Black" Thickness="10" LineJoin="Round"/>
</GeometryDrawing.Pen>
</GeometryDrawing>
</DrawingGroup>
</DrawingImage.Drawing>
</DrawingImage>
<Style x:Key="HexagonButtonStyle" TargetType="{x:Type Button}">
<Setter Property="Background" Value="Khaki"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid>
<Image x:Name="img" Source="{StaticResource HexagonImage}"/>
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="img" Property="Source" Value="{StaticResource HexagonHoverImage}"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="img" Property="Source" Value="{StaticResource HexagonPressedImage}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid>
<local:HexagonGrid Rows="4" Columns="1" HexagonSideLength="40">
<local:HexagonGrid.Resources>
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource HexagonButtonStyle}"/>
</local:HexagonGrid.Resources>
<Button Grid.Row="0" Grid.Column="2" Content="0,2"/>
<Button Grid.Row="0" Grid.Column="1" Content="0,1"/>
<Button Grid.Row="1" Grid.Column="2" Content="1,2"/>
</local:HexagonGrid>
</Grid>
</Window>