This is a migrated thread and some comments may be shown as answers.

WindowStartupLocation Relative to Button Pressed

6 Answers 84 Views
Window
This is a migrated thread and some comments may be shown as answers.
Mike Lee
Top achievements
Rank 1
Mike Lee asked on 17 Feb 2010, 04:44 PM
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

6 Answers, 1 is accepted

Sort by
0
Accepted
Miroslav Nedyalkov
Telerik team
answered on 17 Feb 2010, 05:04 PM
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.
0
Mike Lee
Top achievements
Rank 1
answered on 17 Feb 2010, 05:26 PM
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.
0
Miroslav Nedyalkov
Telerik team
answered on 17 Feb 2010, 05:47 PM
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.
0
Mike Lee
Top achievements
Rank 1
answered on 18 Feb 2010, 01:11 PM
Great, thanks for clarifying.

Mike
http://www.eikospartners.com
0
Anjani
Top achievements
Rank 1
answered on 22 Jun 2011, 12:49 PM
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 !
0
Miroslav Nedyalkov
Telerik team
answered on 27 Jun 2011, 08:39 AM
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
Tags
Window
Asked by
Mike Lee
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
Mike Lee
Top achievements
Rank 1
Anjani
Top achievements
Rank 1
Share this question
or