Recommended

Skip Navigation LinksHome / Tips

Tips

+
Page 
Items Resolution

  • 2 comments  /  posted by  Denislav Savkov  on  Aug 29, 2008 (more than a year ago)

    You can get the coordinates of a System.Windows.UIElement relative to any other UIElement. Probably the most common scenario is to get the coordinates of a child element so this is our example.

    C#

    GeneralTransform generalTransform = childElement.TransformToVisual( parentElement );
    Point childToParentCoordinates = generalTransform.Transform( new Point( 0, 0 ) );

    Note! If the child is in left of the parent element or above it, the coordinates will be negative.

    Share


  • 0 comments  /  posted by  Denislav Savkov  on  Aug 29, 2008 (more than a year ago)

    System.Windows.Application is a special class dedicated to the application. Using it you can get a few useful references one of which is the RootVisual.

    C#

    UIElement applicationRoot = Application.Current.RootVisual;

    That's it!

    Share

Page 
Help us make SilverlightShow even better and win a free t-shirt. Whether you'd like to suggest a change in the structure, content organization, section layout or any other aspect of SilverlightShow appearance - we'd love to hear from you! Need a material (article, tutorial, or other) on a specific topic? Let us know and SilverlightShow content authors will work to have that prepared for you. (hide this)