Skip Navigation LinksHome / Tips

Tips

+
Page 
Items Resolution

  • 3 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 
Join the free SilverlightShow webcast 'Running Silverlight Outside the Browser and with Elevated Trust'. Sept 7th, 8 am - 9 am PDT.
In this live session Chris Anderson will cover configuring and debugging OOB mode, toast notifications, elevated trust, direct file access and much more.
Learn more | Register | See more webinars (hide this)