SizeToContent concerns with RadWindow

3 posts, 1 answers
  1. Greg
    Greg avatar
    34 posts
    Member since:
    Sep 2012

    Posted 18 Sep 2012 Link to this post


    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. Answer
    Vladi avatar
    749 posts

    Posted 20 Sep 2012 Link to this post

    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.

    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.

  3. Greg
    Greg avatar
    34 posts
    Member since:
    Sep 2012

    Posted 21 Sep 2012 Link to this post

    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.
Back to Top