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

RadGridView in a User control

2 Answers 68 Views
GridView
This is a migrated thread and some comments may be shown as answers.
dylan
Top achievements
Rank 1
dylan asked on 17 Sep 2008, 11:51 AM
Hi

I am having trouble with the automaic resizing of the radgridview control. If I place it directly inside a grid column row and then set margins to 0 every thing works great and the radgridview fills the area.

If, however, I package the gridview in a usercontrol (within a grid element), and set the margins to 0, the radgridview fills the area as expected. When I then place the resultant usercontrol within a grid cell on a page the usercontrol does not honour the margin 0 properties. The radgridview seems to keep the usercontrol a constant size when manipulating the anchored margins within expression, Visual Studio or manually in the XAML.

I am wondering firstly if this is a bug, secondly if there is a workaround. In your sample application it seems to work fine.

Thanks in advance
Dylan

2 Answers, 1 is accepted

Sort by
0
Atanas
Telerik team
answered on 17 Sep 2008, 01:46 PM
Hi Dylan,

This is not a bug, actually. The reason of your issue is that the default value of Width and Height properties of the UserControl is 300, and the only thing you need to do is to change them to Auto:

<UserControl x:Class="RadGridViewInUserControl.GridControl" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" 
    Height="Auto"  Width="Auto"
    <Grid> 
    <telerik:RadGridView Margin="0" Name="radGridView1" /> 
    </Grid> 
</UserControl> 

I'm attaching you a sample project to demonstrate the case.
I hope this solves your issue.

All the best,
Atanas
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
dylan
Top achievements
Rank 1
answered on 17 Sep 2008, 02:59 PM
Hi$0$0$0$0Thanks that worked : ). I suppose I sould have checked this with other standard controls in a usercontrol to see what the default 'filling' behaviour of them is.$0$0$0$0$0Thanks$0$0Dylan$0$0$0$0$0$0$0
Tags
GridView
Asked by
dylan
Top achievements
Rank 1
Answers by
Atanas
Telerik team
dylan
Top achievements
Rank 1
Share this question
or