WindowStartupLocation Relative to Button Pressed

7 posts, 1 answers
  1. Mike Lee
    Mike Lee avatar
    11 posts
    Member since:
    Jan 2010

    Posted 17 Feb 2010 Link to this post

    Hi, how do I show a RadWindow next to the button that is pressed to open the RadWindow?  For Example, I want the RadWindow to appear 10 pixels below, and 30 pixels to the left, relative to the button that opens the RadWindow.  Thanks!

    Mike
    http://www.eikospartners.com
  2. Answer
    Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 17 Feb 2010 Link to this post

    Hi Mike,

     You could use the Left and Top properties of the RadWindow control - they set its absolute position. In order to find out what is the absolute position of the button, you could use its TransformToVisual method - it returns a transformation and you can use it to transform a new point. Here is an example:

    var point = button.TransformToVisual(null).Transform(new Point(0, 0));
    window.Left = point.X;
    window.Top = point.Y;

    Hope this helps.

    Regards,
    Miroslav Nedyalkov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. DevCraft banner
  4. Mike Lee
    Mike Lee avatar
    11 posts
    Member since:
    Jan 2010

    Posted 17 Feb 2010 Link to this post

    This works perfectly.  Thanks!

    Mike
    http://www.eikospartners.com

    P.S.  It would be a nice feature if there was a RelativeLeft and ReleativeTop, only to make it easier for Designers who usually work with XAML with minimal code-behind.
  5. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 17 Feb 2010 Link to this post

    Hi Mike,

     Thank you for your suggestion, but unfortunately this is not a straight-forward task. 

    If we add such properties there are a lot of questions to answered in order to implement them. First of all we need to know relative to whom should be this position. Another problem is when we need to update the Left and Right properties using the relative values. For example - in your case you need to have relative coordinates from a button - imagine that this button moves - because of the layout or because of a RenderTransform. It is very complicated to determine when we should update the position.

    Because of these problems we proffered to the user of the RadWindow control to implement this in the manner he/she prefers to do that.

    Sincerely yours,
    Miroslav Nedyalkov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  6. Mike Lee
    Mike Lee avatar
    11 posts
    Member since:
    Jan 2010

    Posted 18 Feb 2010 Link to this post

    Great, thanks for clarifying.

    Mike
    http://www.eikospartners.com
  7. Anjani
    Anjani avatar
    21 posts
    Member since:
    Mar 2011

    Posted 22 Jun 2011 Link to this post

    Hi Miroslav Nedyalkov,
    My environment : Silverlight with MVVM design pattern
    The solution that you have suggested takes care of initial location of radwindow with respect to a button. But this solution fails in 2 scenarios :
    1 - after the radwindow is launched, manually if it is moved to a differnet location and closed, on next launch, it does not open relative to the button instead it opens at the place where it was manually dragged
    2 - How can I keep the location of radwindow ALWAYS relative to the button even when the browser window is resized ?

    Waiting to hear from you !
    ~ Anjani !
  8. Miroslav Nedyalkov
    Admin
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 27 Jun 2011 Link to this post

    Hello Anjani,

     As I mentioned before this is not a built-in feature of the RadWindow control, but a custom code that solves a custom problem. Currently we don't have an example of what you want to achieve as it is not easy to do it for all the cases. If you know all the scenarios when this button would be moved you could just update the window's location when any of these events occurs.

    Hope this helps.

    Regards,
    Miroslav Nedyalkov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top
DevCraft banner