0

I'd like to bind the Width of my RowDetailsTemplate to the Width of my DataGrid, so that the row details are not surrounded with scroll bars.

Here's the problem: alt text

Notice that the RowDetailsTemplate contains hidden content that must be scrolled into view - which is terrible. The user must drag the scroll bar at the very bottom bottom of the DataGrid in order to see the rest of the row's details - which is very unintuitive. I really want the row details to layout its content such that no scrolling is necessary.

Any suggestions?

Thanks,
Charles

Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Charles
  • 6,199
  • 6
  • 50
  • 66

2 Answers2

2

I did find the solution for a similar problem in WPF, you can find it here: DataGrid RowDetails Width problem

I don't know if it works in silverlight, but give it a try.

The answers here felt like a workaround so I did some research and did find the solution on the Telerik forums, since we use their RadGridView. Turned out the solution worked for DataGrid as well.

The key is to set the ScrollViewer.HorizontalScrollBarVisibility property to Disabled, see example below.

<DataGrid ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<DataGrid.RowDetailsTemplate>
    <DataTemplate>
        <Border>
            <TextBlock Foreground="White" Text="{Binding RowDetails}"
                       TextWrapping="Wrap"/>
        </Border>
    </DataTemplate>
</DataGrid.RowDetailsTemplate> </DataGrid>
Community
  • 1
  • 1
TGasdf
  • 1,220
  • 12
  • 14
1

Setting the AreRowDetailsFrozen property on my DataGrid to true solved my problem. Example:

<data:DataGrid AreRowDetailsFrozen="True" />
Charles
  • 6,199
  • 6
  • 50
  • 66