Bug in DataGrid RowDetailTemplate when changing width

Jun 24, 2009 at 1:36 PM

Hello all,

I believe I have found a bug in the way the DataGrid from the WPF Toolkit handles resizing when using RowDetailTemplates.

More specifically, I use a RowDetailTemplate that contains content aligned to the right (originally, it was a textbox that was supposed to fill all the space, but for the purpose of reporting this issue, it is simpler to demonstrate with a right-aligned text block).
When the width of the datagrid is increased (window is made wider), the width of the RowDetail-area is also increased, which is fine.
If, then, the width is decreased again, the RowDetail area stays wide, which means right-aligned contents disappears.

Here is a minimal demonstrator:

<Window x:Class="QuickTest.Window1"    
        Title="Window1" Height="300" Width="300">
    <toolkit:DataGrid AutoGenerateColumns="False" SelectionUnit="FullRow" 
            <toolkit:DataGridTextColumn Header="Sample column - click empty row" Width="*"></toolkit:DataGridTextColumn>
                <Grid Margin="5">
                        <RowDefinition Height="Auto"></RowDefinition>
                        <ColumnDefinition Width="*"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    <TextBlock Grid.Column="1">move right window border further right and then left again - behold, this text disappears!</TextBlock>
        </toolkit:DataGrid.RowDetailsTemplate> >

Code-behind is not necessary for this example. To make the problem appear, make the window first wider and then narrow again.

Is this a known problem? It poses a severe problem in a project I am working on, so any hints or suggestions regarding possible workarounds will be more than welcome.

Many thanks,
Christian Korn

Jun 26, 2009 at 10:45 AM
Edited Jun 26, 2009 at 10:47 AM

The problem still exists in the June 2009 version of the WPF Toolkit. I created issue http://wpf.codeplex.com/WorkItem/View.aspx?WorkItemId=10196 .