1 column grid with text wrap

2 posts, 0 answers
  1. Jonathan
    Jonathan avatar
    15 posts
    Member since:
    Jul 2012

    Posted 22 Nov 2010 Link to this post

    I have a radgridview like following:

    <telerik:RadGridView x:Name="_Grid"
            <telerik:GridViewDataColumn Header="Bookmarks" DataMemberBinding="{Binding BookMarkText}" TextWrapping="Wrap">
                        <Grid HorizontalAlignment="Stretch">
                                <ColumnDefinition Width="Auto"/>
                            <TextBlock TextWrapping="Wrap" Text="{Binding BookMarkText}" Style="{StaticResource FieldLabelTextBlock}" />
                            <TextBlock TextWrapping="Wrap" Grid.Row="1" Text="{Binding Description}" HorizontalAlignment="Stretch"/>

    ie a grid with only a single column and cells with content that (I wish) wraps in the available horizontal space. However the content continues "off the screen" and a horizontal scroll bar appears instead. (screenshot, left)

    I can't hard code the width of the grid or the column, as it is in a user-adjustable pane.

    Furthermore, if I increase the width of the pane, an additional, "dummy" column is added (screenshot, right)

    How can I have the text in the grid wrap (highest priority)?
    How can I not have the "dummy" column appear (not a major issue)?

    Assistance appreciated

  2. Ivan Ivanov
    Ivan Ivanov avatar
    1201 posts

    Posted 23 Nov 2010 Link to this post

    Hi Jonathan,

    I have managed to achieve the desired effect by changing a little bit your own project. This declaration of DataTemplate fixes the text wrapping issue. As the "dummy" column is concerned, you should use "*" width to your single column to let it flow fully into all the space available. I am attaching you my project to throw some more light upon my solution.

    Ivan X1
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for Silverlight
Back to Top