2

I am new to WPF and have a Path data like:

M44.3364,36.7461C42.2004,42.9021,36.3504,47.3241,29.4644,47.3241C20.7724,47.3241,13.7244,40.2761,13.7244,31.5851

Now I want to get height and width of this path data, how to do it?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Shanmukh
  • 35
  • 1
  • 4

1 Answers1

2

You may get the Bounds of the Path's Data:

<Path x:Name="path" Stroke="Black"
      Data="M44.3364,36.7461C42.2004,42.9021,36.3504,47.3241,29.4644,47.3241C20.7724,47.3241,13.7244,40.2761,13.7244,31.5851"/>

Code:

Rect bounds = path.Data.Bounds;
Clemens
  • 123,504
  • 12
  • 155
  • 268