Unable to "clear" height and width...

7 posts, 0 answers
  1. Rusty
    Rusty avatar
    4 posts
    Member since:
    Jun 2011

    Posted 08 Sep 2011 Link to this post

    I suspect I'm simply being a little dense here, but how do you go about programatically clearing height and width once they've been set either by the user or programatically?  I am using a static instance of a RadWindow as the modal dialog for an application.  However, once I set the height and width values or once the user has resized the window, I cannot manage to "clear" or "reset" the values at all so that the RadWindow will start autosizing again...  I'm using file version 2011.2.712.1040.
  2. Dani
    Admin
    Dani avatar
    848 posts

    Posted 09 Sep 2011 Link to this post

    Hello Rusty,

    You can use the LayoutChangeEnded event. It will be called once your RadWindow finishes resizing or dragging. You can wire up your own logic in the event handler and set new sizes for the window.

    I hope this will be helpful.

    All the best,
    Dani
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  3. DevCraft banner
  4. Rusty
    Rusty avatar
    4 posts
    Member since:
    Jun 2011

    Posted 09 Sep 2011 Link to this post

    The issue is that I don't want to set a new size. Once the window is closed, I would like to "clear" the height and width so that the next time ShowDialog is called, the window will automatically resize to fit its new content. I'm not sure how wiring up the event you specified will help me achieve that...
  5. Dani
    Admin
    Dani avatar
    848 posts

    Posted 12 Sep 2011 Link to this post

    Hi Rusty,

    Are you trying to "reset" the window to its default size, or are you trying to keep and "remember" the resized dimensions the second time the window opens?

    The later scenario you described is part of the default behavior of RadWindow. Up till now there was an issue with this functionality. The issue was fixed and will be available officially with the Q2 SP1 release around the 20th September.

    I hope this helps.

    Regards,
    Dani
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  6. Rusty
    Rusty avatar
    4 posts
    Member since:
    Jun 2011

    Posted 12 Sep 2011 Link to this post

    Hello Dani!  Let me restate the problem for completeness and clarity.

    My application uses a RadWindow as a modal popup with an implementation similar to the one described at the following link:

    http://www.telerik.com/community/code-library/silverlight/general/mvvm-utilizing-radwindow-for-your-popups.aspx

    Until now, we have not allowed the user to resize the popup.  As such, each time the content property as assigned, the window automatically resized to fit the content.  This is fantastic behavior and exactly what we wanted... until we created a popup window where resizing is necessary.  Once the dialog has been resized, since it's a singleton, any subsequent popups will also show at the user-set size.  What we would like to be able to do is clear any user-set (or programatically set) size when the dialog is closed so that the popup will resume the behavior of automatically resizing to fit when its content property is assigned. 

    To answer your questions: we are not trying to "reset" the window size or "remember" the size.  We actually want to "clear" the size altogether so that the window will resume its auto-sizing behavior.  We want the window to act as if it has never had its size properties set.

    --Rusty
  7. Ivo
    Admin
    Ivo avatar
    390 posts

    Posted 16 Sep 2011 Link to this post

    Hello Rusty,

    Sorry for the late reply.

    I would suggest you set RadWindow's Height and Width to NaN when the RadWindow is closing. This way you will achieve the desired behaviour. Here is sample code:
    void RadWindow_Closed(object sender, WindowClosedEventArgs e)
    {
        // Set our window back to default values
        SetDefaultWindowValues();
        // Unregister when the Window is closed.
        Application.Current.Host.Content.Resized -= new EventHandler(Content_Resized);
        // Remove whatever is assigned to the content when the window is closed.
        _radWindow.Content = null;
        _radWindow.Height = double.NaN;
        _radWindow.Width = double.NaN;
        if (MainRadWindowClosed != null)
            MainRadWindowClosed(this, null);
    }

    Hope this helps.

    All the best,
    Ivo
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
  8. Rusty
    Rusty avatar
    4 posts
    Member since:
    Jun 2011

    Posted 16 Sep 2011 Link to this post

    Hello Ivo!  That worked magnificently, thanks!

    --Rusty
Back to Top
DevCraft banner