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

Centralize the window after loading the radgrid

2 Answers 44 Views
Window
This is a migrated thread and some comments may be shown as answers.
Raj A R
Top achievements
Rank 1
Raj A R asked on 26 Oct 2009, 09:24 AM
Hello Team,

I have one radwindow with a Radgrid inside it, I'm populating the grid in dataservice complete event, so when the popup is opened  window is centralized (which is centralized using win.WindowStartupLocation = WindowStartupLocation.CenterScreen this code while initializing the window).

ie before populating the radgrid the window is centralized.

But one my collection is loaded and the radgrid is loaded this window is expanding towards the right.
How can i make that centralized? 
is there any property like window.Center()  which is available in the ASP.net window?
or is there any way to refresh the window so that it will automatically centralized?

-Raj

2 Answers, 1 is accepted

Sort by
0
Miroslav Nedyalkov
Telerik team
answered on 28 Oct 2009, 08:49 AM
Hello Raj,

Unfortunately there is no such method, but it sounds really useful. I log your request in our system and we will consider implementing it in one of the upcoming releases.

In order to workaround this problem you could either load the data before open the RadWindow control or implement your own centralization logic - it is really simple - set window's Left property to (screenWidth - window.ActualWidth) and the Top property to (screenHeight-window.ActualHeight), where screenWidth and screenHeight is the size of your application. 

Hope this helps.

Best wishes,
Miroslav Nedyalkov
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Raj A R
Top achievements
Rank 1
answered on 29 Oct 2009, 11:27 AM
thanks Miroslav ,

the below code solves my problem :)

Size appSize = Application.Current.RootVisual.RenderSize;
window.Left = Math.Round((appSize.Width / 2) - (window.ActualWidth / 2), 0);
window.Top = Math.Round((appSize.Height / 2) - (window.ActualHeight / 2), 0);
window.ShowDialog();

-Raj
Tags
Window
Asked by
Raj A R
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
Raj A R
Top achievements
Rank 1
Share this question
or