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

Resizing the RadWindow to its contents

2 Answers 116 Views
Window
This is a migrated thread and some comments may be shown as answers.
Shane Woodward
Top achievements
Rank 1
Shane Woodward asked on 11 Feb 2010, 02:15 AM
Hi,

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"
                                CanClose="True"
                                CanMove="True"
                                Header="Edit items"
                                CloseMode="Close"
                                WindowStartupLocation="CenterParent"
                                ResizeMode="CanResize"
                                Width="790"
                                Height="250"
                                HorizontalContentAlignment="Center"
                                >
    <Grid>
        <Canvas x:Name="PopupWindowContents">
            
        </Canvas>
    </Grid>
</telerikNavigation:RadWindow>


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 Answers, 1 is accepted

Sort by
0
Accepted
Miroslav Nedyalkov
Telerik team
answered on 11 Feb 2010, 09:31 AM
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.

Regards,
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.
0
Shane Woodward
Top achievements
Rank 1
answered on 11 Feb 2010, 10:49 AM
Awesome! That worked perfectly!

Thank you very much :)
Tags
Window
Asked by
Shane Woodward
Top achievements
Rank 1
Answers by
Miroslav Nedyalkov
Telerik team
Shane Woodward
Top achievements
Rank 1
Share this question
or