DataGrid: GroupStyle + EnableRowVirtualization

Apr 6, 2009 at 8:09 PM
Edited Apr 6, 2009 at 10:08 PM
Using the DataGrid, if I have a GroupStyle, should virtualization be getting disabled?  According to Mole it is, without grouping the virtualization works as expected.  If this is expected, does this implicit disabling of other configurations get logged anywhere?  Like a warning in one of the WPF TraceSources (I was unable to find anything getting logged)?

The group containers are expanders.  The expanders themselves appear to be getting virtualized correctly and when collapsed are also virtualizing correctly, but if a group is expanded, visual children are created for everything in the <ItemsPresenter> for the expander.

    <wpftk:DataGrid
                    VerticalAlignment="Stretch"
                    AutoGenerateColumns="False"
                    EnableColumnVirtualization="True"
                    EnableRowVirtualization="True"
                    HeadersVisibility="None"
                    VerticalScrollBarVisibility="Auto"
                    HorizontalScrollBarVisibility="Auto"
                    AllowDrop="True"
                    HorizontalContentAlignment="Stretch"
                    SelectionMode="Extended"
                    SelectionUnit="FullRow"
                    GridLinesVisibility="None">
      
      <wpftk:DataGrid.Columns>
         ...
      </wpftk:DataGrid.Columns>

      <wpftk:DataGrid.GroupStyle>
        <GroupStyle>
                   
          <GroupStyle.ContainerStyle>
            <Style TargetType="{x:Type GroupItem}">
              <Setter Property="Template">
                <Setter.Value>
                  <ControlTemplate TargetType="{x:Type GroupItem}">
                    <Expander IsExpanded="False">
                      <Expander.Header>
                        <DockPanel TextBlock.FontWeight="Bold">
                          <TextBlock Text="{Binding Path=Name}"
                                             Margin="5,0,5,0"/>
                          <TextBlock Text="{Binding Path=ItemCount}"/>
                        </DockPanel>
                      </Expander.Header>
                      <ItemsPresenter />
                    </Expander>
                  </ControlTemplate>
                </Setter.Value>
              </Setter>
            </Style>
          </GroupStyle.ContainerStyle>
        </GroupStyle>
      </wpftk:DataGrid.GroupStyle>

    </wpftk:DataGrid>

Update 1:
One difference I've noticed on the DataGridRowsPresenter that is being created is that without a group, the ScrollOwner is correctly set.  With a group style set, the ScrollOwner is null.