问题
I am trying to make XAML Polygon filled with a transformed texture. The code worked well in WPF but in a Windows 10 app there seems to be no TileMode property.
<Polygon Points="300,200 400,125 400,275" Stroke="Purple" StrokeThickness="2">
<Polygon.Fill>
<ImageBrush TileMode="Tile" ImageSource="Assets/StoreLogo.png">
<ImageBrush.RelativeTransform>
<TransformGroup>
<ScaleTransform CenterY="0.5" CenterX="0.5" ScaleX="0.2" ScaleY="0.2"/>
<SkewTransform CenterY="0.5" CenterX="0.5"/>
<RotateTransform CenterY="0.5" CenterX="0.5" Angle="61.928"/>
<TranslateTransform/>
</TransformGroup>
</ImageBrush.RelativeTransform>
</ImageBrush>
</Polygon.Fill>
</Polygon>
回答1:
You can tile using the Win2D library. They have sample code as well; there's a tiling sample under "effects" (EffectsSample.xaml.cs
).
来源:https://stackoverflow.com/questions/35574505/how-to-fill-a-win10-xaml-polygon-with-tiles