Resizing the RadWindow to its contents

3 posts, 1 answers
  1. Shane Woodward
    Shane Woodward avatar
    13 posts
    Member since:
    Jan 2010

    Posted 10 Feb 2010 Link to this post


    when using the Silverlight RadWindow, is there a way to make it auto size to its contents? This is my popup window:

    <telerikNavigation:RadWindow    x:Name="PopupWindow"
                                    Header="Edit items"
            <Canvas x:Name="PopupWindowContents">

    At run time i am selecting a usercontrol, and populating it into the "PopupWindowContents" canvas. The user control consists of a grid with four column definitions (two columns of labels, and two columns of edit controls). The two column definitions for the label columns do not have a width specified, they end up taking up the width of the widest label (which of course is a product of both the font and the length of the string in the label). At the moment i place the control into the canvas, the Width of the control reads as 0 (possibly because the control has been created but not yet rendered?)

    As you can see, i am explicity setting the height/width of the RadWindow, which i want to avoid. Can you advise if there is some way i can set the size to that of the usercontrol once it is loaded? (i'm using a trial version of your controls that i downloaded approx 4 weeks ago - great controls BTW!)

    Thanks :)
  2. Answer
    Miroslav Nedyalkov
    Miroslav Nedyalkov avatar
    1718 posts

    Posted 11 Feb 2010 Link to this post

    Hello Shane,

     The problem you are experiencing is because of the Canvas panel - when it is measured and arranged by the layout system its render size is always (0, 0) except if you explicitly set something different. I would advise you to use a Grid panel and remove the Width and Height attributes from the RadWindow tag.

    Hope this helps.

    Miroslav Nedyalkov
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
  3. Shane Woodward
    Shane Woodward avatar
    13 posts
    Member since:
    Jan 2010

    Posted 11 Feb 2010 Link to this post

    Awesome! That worked perfectly!

    Thank you very much :)
Back to Top