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>
&开发者_运维技巧lt;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?
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?
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.
精彩评论