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

RowDetails and Text Wrapping

4 Answers 144 Views
GridView
This is a migrated thread and some comments may be shown as answers.
yonadav
Top achievements
Rank 1
yonadav asked on 16 Feb 2010, 08:45 AM
Hi,

We've replaced our earlier use of child grids with a simplified RowDetails, something that looks like this:

       <telerik:RadGridView.RowDetailsTemplate> 
            <DataTemplate> 
                <Grid> 
                    <Grid.ColumnDefinitions> 
                        <ColumnDefinition Width="80" /> <!-- A kind of margin we're using --> 
                        <ColumnDefinition Width="*" /> 
                    </Grid.ColumnDefinitions> 
                    <!-- Here there is a component that appears in column 0 --> 
                     
                    <!-- The actual description  --> 
                    <TextBlock  
                        Grid.Column="1" 
                        Text="{Binding Description, Mode=OneWay}"  
                        TextWrapping="Wrap"/> 
                </Grid> 
            </DataTemplate> 
        </telerik:RadGridView.RowDetailsTemplate> 

When viewing this, the TextBlock fails to wrap the text.

Based on our understanding, this is because the owning Grid is taking more than the visible width. However, it's possible there's a mistake here.

Can you help us understand why the TextBlock is not wrapping?

Thanks,
yonadav

4 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 16 Feb 2010, 08:55 AM
Hi yonadav,

The TextBlock is not wrapping because its parent element, a Grid in this case, is measured with positive infinity. In other words it has no explicit width specified and the layout system lets it occupy as much horizontal space as it needs. If you want wrapping to occur, you will need to specify width for either the parent Grid (i.e. the top-level element inside the Row Details template) or the TextBlock itself. I hope this makes sense.

All the best,
Ross
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
yonadav
Top achievements
Rank 1
answered on 16 Feb 2010, 09:46 AM
Hi Ross,

We do not know what width to use as the window can resize. The owning RadGridView control doesn't have a specific width to it either, it simply takes up the entire available width (within the Grid it is located). This means, we need the Grid within the RowDetails to take up the entire width of its parent, and for the parent (RowDetails control??) to take up the entire width (and only that) of the RadGridView.

Does this make sense?

Thanks,
yonadav
0
Rossen Hristov
Telerik team
answered on 16 Feb 2010, 10:02 AM
Hi yonadav,

If this is the case you will have to turn horizontal scrolling off. When you turn horizontal scrolling off, RadGridView will be able to calculate the horizontal space that is available to it and the wrapping will be possible. When horizontal scrolling is on -- the space available is unlimited, endless, infinite, etc.

The main point is that for something to wrap it needs to know how much width does it have available. If the width is infinite, then no wrapping can occur since everything can fit on a single line no matter how long the text is.

I have prepared a small sample project that demonstrates the text wrapping in action. Please, resize the window in various directions to see the text wrapping in action.

I hope this helps.

Sincerely yours,
Ross
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
yonadav
Top achievements
Rank 1
answered on 24 Feb 2010, 04:09 PM
Hi Ross,

Turning off horizontal scrolling solved it.

Thank you for your help,
yonadav
Tags
GridView
Asked by
yonadav
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
yonadav
Top achievements
Rank 1
Share this question
or