tags:

views:

268

answers:

1

In this question I talk about a star-shape: http://stackoverflow.com/questions/839843/reuse-path-object-in-xaml)

<Path x:Name="NiceStar" StrokeThickness="10" Stroke="#ff000000" StrokeMiterLimit="1" Data="F1 M 126.578613,11.297852 L 162.373535,83.825684 L 242.412598,95.456055 L 184.495605,151.911133 L 198.167480,231.626953 L 126.578613,193.990234 L 54.988770,231.626953 L 68.661621,151.911133 L 10.744629,95.456055 L 90.783691,83.825684 L 126.578613,11.297852 Z">
 <Path.Fill>
  <RadialGradientBrush MappingMode="Absolute" GradientOrigin="390.395508,448.130371" Center="390.395508,448.130371" RadiusX="113.034821" RadiusY="113.034821">
   <RadialGradientBrush.Transform>
    <MatrixTransform Matrix="1,0,-0,-1,-263.816895,569.592773" />
   </RadialGradientBrush.Transform>
   <GradientStop Offset="0" Color="#ff00ff00"/>
   <GradientStop Offset="1" Color="#ff006736"/>
  </RadialGradientBrush>
 </Path.Fill>
</Path>

Now I want to resize this star to a very small size and place it in a grid. When I use a ScaleTransform for this, the star takes as much size as it did before resizing. What's the best way of doing this, so resizing and making sure the star doens't take too much space?

+2  A: 

Instead of doing

<Path.RenderTransform>
   <ScaleTransform ScaleX="0.1" ScaleY="0.1"></ScaleTransform>
</Path.RenderTransform>

try

<Path.LayoutTransform>
   <ScaleTransform ScaleX="0.1" ScaleY="0.1"></ScaleTransform>
</Path.LayoutTransform>

LayoutTransform applies the transforms before the layout pass.

HTH

PaulB