Mega Code Archive

 
Categories / C# / WPF
 

Transform Path defined in Resource

<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"       Background="White">     <Viewbox>         <Canvas Width="200" Height="200" RenderTransform="1 0 0 -1 100 100" >             <Canvas.Resources>                 <Style TargetType="{x:Type Path}" x:Key="petal">                     <Setter Property="Stroke" Value="Black" />                     <Setter Property="Fill" Value="Red" />                     <Setter Property="Data"                              Value="M 10 10 C 2.5 112.5, 417.5 2.5, 60 0 C 47.5 -112.5, 12.5 -2.5, 0 0 Z" />                 </Style>             </Canvas.Resources>             <Path Stroke="Green" StrokeThickness="5" Data="M -10 -10 C -10 -50, -50 50, 0 0">             </Path>             <Path Style="{StaticResource petal}" />             <Path Style="{StaticResource petal}" RenderTransform="1.7 -1.7 .7 .7 0 0" />             <Path Fill="Yellow" Stroke="Black">                 <Path.Data>                     <EllipseGeometry Center="0 0" RadiusX="15" RadiusY="15" />                 </Path.Data>             </Path>         </Canvas>     </Viewbox> </Page>