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

3 posts, 0 answers
  1. Ilya
    Ilya avatar
    5 posts
    Member since:
    Aug 2013

    Posted 16 Sep 2013 Link to this post


    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" >
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="*" />
                <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}" />

    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. Pavel R. Pavlov
    Pavel R. Pavlov avatar
    1167 posts

    Posted 19 Sep 2013 Link to this post

    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.

    Pavel R. Pavlov
    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 >>
  3. DevCraft banner
  4. Ilya
    Ilya avatar
    5 posts
    Member since:
    Aug 2013

    Posted 17 Oct 2013 Link to this post

    Your suggestion works great.

    Thank you.
Back to Top