tags:

views:

26

answers:

2

Now this question looks similar to the question I've asked here, however, this time I have multiple Path objects. I want to create a control that centers the paths nicely. Example:

<Grid>  
    <Path Stroke="Black" Data="M 3,3 L 7,4 3,12 3,3" />
    <Path Stroke="Black" Data="M 3,6 L 7,4 12,6 3,6" />
</Grid>

Is there an easy way to achive this?

+1  A: 

I'm not certain what effect you want, if you use Stretch="Fill" on the path objects, it will center them and stretch them. I presume you want to just center them though? However what does HorizontalAlignment="Center" and VerticalAlignment="Center" do if you set Stretch="Uniform" on each path?

Max Palmer
This is not the effect I'm after. I want the objects to stay in their relative position, only change the zoom factor.
Robbert Dam
But thanks anyway :)
Robbert Dam
A: 

Eventually I solved this in code-behind. I calculated the minimum and maximum values (for X/Y) in my geometry. I applied a ScaleTransform with a calculated zoom factor.

Robbert Dam