DataGrid RowDetailsTemplate Layout Problems

Dec 18, 2008 at 10:42 PM
Edited Dec 18, 2008 at 10:45 PM

I use a datagrid and do the following:

<Border BorderBrush="Red" BorderThickness="2" HorizontalAlignment="Stretch" CornerRadius="2" Background="Black" Margin="3" Padding="2"> 
<Grid HorizontalAlignment="Stretch" Margin="5"> 
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="*"/>
<Label Foreground="Wheat">Detail Info:</Label>
<TextBlock Grid.Column="1" Foreground="CadetBlue" FontSize="20" HorizontalAlignment="Right" Margin="5" Text="Test" /> 






Further I set:  RowDetailsVisibilityMode="VisibleWhenSelected"

When I select a row the Border is not completly displayed.
Some parts are missing on the right side.
If I make the grid larger (drag up the window) the right side comes in view.
Making it a bit smaller bring up a scrollbar - if I click on it it disapears.

Anyhow: Is there a workaround for this?
What I need is a details pane with a border showing some values "spreaded".
So the label is on the first Colum - the content on the second colums - right aligned.

I hope anyone can help (and I guess I simply made a silly mistake :))


Dec 19, 2008 at 7:29 AM

I cut and paste your RowTemplate into a grid that I have and it works just fine, the border is visible and occupies the entire horizontal area.

Perhaps the problem lies in your DataGrid configuration. Can you perhaps provide a more complete example?

Colin E.
-- - my WPF blog - WPF DataGrid Practical Examples
Dec 19, 2008 at 11:04 AM
Hi the problem does not exist if the DG stays in size,
Simply try to make the grid fill the entire window and then resize the window.

Important -- it seems as if the problem comes up more reproducable when a vertical scrollbar exists.
My DG has three columns -- Width="*", Width="200", Width="200"
And it has about 200 lines of data (so it always scrolls).
Jan 6, 2009 at 4:13 AM
Edited Jan 6, 2009 at 4:14 AM
Hi Colin E,
I want to use the WPF Datagrid Practical Examples from the link which you have mentioned (
But when i download the project and open it, one project called "WPFToolkit" is missing. I think "WPFToolkit" dll is used as reference in the datagrid project.
I have dowloaded the open source "WPFtoolkit" project also but am not able to build it due to some errors.
Can you please help me put how to make this sample project run using "WPFToolkit" dll?

Thanks in advance