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

Avoid stretching of grid column when column's content width changes

2 Answers 116 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Ilya
Top achievements
Rank 1
Ilya asked on 16 Sep 2013, 10:38 AM

Hello.

I have a problem with columns in grid. I would like to have columns with the same width and this width should not depend on the content of the columns.

Here is my code:

    <Grid Margin="5" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="*" />
            </Grid.ColumnDefinitions>

            <telerik:RadTreeView Margin="5,0,5,0" Grid.Column="0" 
                                 ItemsSource="{Binding TreeView0}" />
            <telerik:RadTreeView Margin="5,0,5,0" Grid.Column="1" 
                                 ItemsSource="{Binding TreeView1}" />
            <telerik:RadTreeView Margin="5,0,5,0" Grid.Column="2" 
                                 ItemsSource="{Binding TreeView2}" />
            <telerik:RadTreeView Margin="5,0,5,0" Grid.Column="3" 
                                 ItemsSource="{Binding TreeView3}" />
    </Grid>

When I am expanding tree in RadTreeView the column changes it's width and other columns changes respectively. But I would like to have four columns with width = 1/4 of grid's width. RadTreeView has its own ScrollBar for horizontal scrolling.

Is there any property on RadTreeView that stops it from growing horizontally? I tried to enable horizontal scrollbar but it didn't helped.

2 Answers, 1 is accepted

Sort by
0
Pavel R. Pavlov
Telerik team
answered on 19 Sep 2013, 06:45 AM
Hi Ilya,

In order to visualize the HorizontalScrollBar of the RadTreeView control, you need to set fixed Width of the control. By doing so, when the content of the control does not fit in the available space, the HorizontalScrollBar will appear and you will be able to scroll it.

Please try to set fixed Width of the RadTreeView control and let us now if you have any other questions.

Regards,
Pavel R. Pavlov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Ilya
Top achievements
Rank 1
answered on 17 Oct 2013, 06:10 AM
Your suggestion works great.

Thank you.
Tags
TreeView
Asked by
Ilya
Top achievements
Rank 1
Answers by
Pavel R. Pavlov
Telerik team
Ilya
Top achievements
Rank 1
Share this question
or