none
Path width and height

    Question

  • Hi,

    I need the Width and Height of a path in my application because I want to animate scaling paths to a certain size to fit a parent size (like a zoom effect)

    The problem is Width and Height are not available for my path objects. As you know if Stretching is "None" then Width and Height are zero and path is using just the coordinates from Data.

    Unfortunately for me there isn't any property for  Path objects like ActualWidth and ActualHeight to give me the Path width and height computed based on Path Data.

    So I am left with very little choices.

    Any ideas ?


    Thanks

     

    Thursday, August 07, 2008 7:27 AM

Answers

  •  I see that in Silverlight 2 Geometry (hence Path too) has a new property called Bounds.

    Can anyone confirm that is giving the actual width and height of a path using path data coordinates ?

    Thursday, August 07, 2008 11:33 AM
  • Hi

     I see that in Silverlight 2 Geometry (hence Path too) has a new property called Bounds.

    Can anyone confirm that is giving the actual width and height of a path using path data coordinates ?

    Yes. Is this problem solved?

    Monday, August 11, 2008 1:46 AM

All replies

  •  I see that in Silverlight 2 Geometry (hence Path too) has a new property called Bounds.

    Can anyone confirm that is giving the actual width and height of a path using path data coordinates ?

    Thursday, August 07, 2008 11:33 AM
  • Hi

     I see that in Silverlight 2 Geometry (hence Path too) has a new property called Bounds.

    Can anyone confirm that is giving the actual width and height of a path using path data coordinates ?

    Yes. Is this problem solved?

    Monday, August 11, 2008 1:46 AM
  • Yes, I actually using this property now, thanks anyway for your reply

    Monday, August 18, 2008 4:49 AM
  • How to solve that for Silverlight 1.0 ?

    Monday, September 15, 2008 3:46 AM
  • Hi now silverlight 2.0 is came u can u this .. if u want work in sivlerlight 1.0 u have to use some conversions

    Monday, September 15, 2008 3:50 AM
  • The problem is that I have to find a general solution for all possible paths.

    How to do that?

     

    Monday, September 15, 2008 4:21 AM
  •  My suggestion is you create a wrapping SL 2 application for your SL1 application (you don't need to change much except that you don't create the SL object in JavaScript code but in SL 2)

    Then, you can make an utility method in SL 2 which is accessible from JavaScript to compute the bounds of a path, like:

    Rect GetPathBounds(string name)

    where 'name' is the the  name of the path object.

    SL 2 can marshall name and Rect to JavaSript without a problem.

     

     

    Tuesday, September 16, 2008 3:49 AM
  • Thanks a lot for that idea. The problem is that we are not allowed to install beta versions on production computers.

    I think the only way to get out of that problem is to write something like a object parser that investigates all path sub objects and calculates their width and height. This might be a non 100% solution, but I don't have better one for SL1.

    Other ideas are still welcome ...

    Tuesday, September 16, 2008 4:09 AM
  •  Yes, I thought about that too, but I thought it might be slow if you have a path with many points.

    But I guess that will work in fact very fast for the majority of cases, it's a good idea.

    Tuesday, September 16, 2008 4:16 AM