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

SizeToContent concerns with RadWindow

2 Answers 326 Views
Window
This is a migrated thread and some comments may be shown as answers.
Greg
Top achievements
Rank 1
Greg asked on 18 Sep 2012, 10:34 AM
Hello,

Why don't you let the SizeToContent property of the RadWindow work even when the Width and Height are set?

You have made the SizeToContent property a bool, but it would've been good if it could use the SizeToContent enumerations, that way even if the window was set to a specified width and height, the window would still auto-resize until the user would manually resize the window by dragging its margins.
The problem with this now is that the user has to specify MinWidth and MinHeight to explicit values instead of using MinWidth=Width and MinHeight=Height when the application loads, so the design-time sizes can't be used any more. Also, MinWidth=Width/MinHeight=Height cause the application to crash if trying to set the minimum value to size that is set to auto.

Also, auto-resize stops working as soon as the MaxWidth and MaxHeight are reached. The Window doesn't contract back any more after content gets smaller.

Are there any fixes to this, or easy alternative solutions?

2 Answers, 1 is accepted

Sort by
0
Accepted
Vladi
Telerik team
answered on 20 Sep 2012, 11:12 AM
Hi Greg,

Setting the SizeToContent property while having a specific Width and Height set is not possible in the current version of RadWindow control by design.

I am not sure that I understand the scenario you are trying to implement fully but if you want to set the MinWidth/MinHeight properties to the actual Width/Height of the content in the control you could set them in the Loaded event. The next code snippet represents the described approach:
void radWindow_Loaded(object sender, RoutedEventArgs e)
{
    var radWindow = sender as RadWindow;
 
    radWindow.MinWidth = radWindow.ActualWidth;
    radWindow.MinHeight = radWindow.ActualHeight;
}

On your last question concerning SizeToContent while the MaxHeight is set it seems that it is a bug in the control and we have logged it in our Public Issue Tracker System where you can vote and track its status.

I updated your Telerik points for bringing this to our attention.

Regards,
Vladi
the Telerik team

Time to cast your vote for Telerik! Tell DevPro Connections and Windows IT Pro why Telerik is your choice. Telerik is nominated in a total of 25 categories.

0
Greg
Top achievements
Rank 1
answered on 21 Sep 2012, 07:31 AM
Hi, Vladi. Yes, you are right, I should've set the minimum height and width before enabling ResizeToContent.
Anyway, I concluded that a better way to use RadWindow is within a regular transparent window to which I add window chrome. That way I can still use the looks of a RadWindow and its themes, but add contents in a grid above it.
Tags
Window
Asked by
Greg
Top achievements
Rank 1
Answers by
Vladi
Telerik team
Greg
Top achievements
Rank 1
Share this question
or