views:

16

answers:

1

I've been working with David Poll's CollectionPrinter Control and have successfully printed reports which use a DataGrid to display the collection. Without using grouping in the datagrid it paginates the document normally. However, as soon as I activate grouping following his instructions in one of the first comments from the link above, the grid attempts to display all the items in the first page and gets cut off (no more pagination).

Here is the code that I'm attempting to use for the grouped DataGrid:

<Printing:CollectionPrinter.BodyTemplate>
    <DataTemplate>
        <Grid Height="Auto">
            <Grid.Resources>
                <CollectionViewSource x:Key="groupedCollection" Source="{Binding CurrentItems}">
                    <CollectionViewSource.GroupDescriptions>
                        <PropertyGroupDescription PropertyName="BaFolioNum" />
                        <PropertyGroupDescription PropertyName="CategoryDesc"/>
                    </CollectionViewSource.GroupDescriptions>
                </CollectionViewSource>
            </Grid.Resources>
            <sdk:DataGrid  ItemsSource="{Binding Source={StaticResource groupedCollection}}" AutoGenerateColumns="False" 
                          VerticalScrollBarVisibility="Disabled">
                <sdk:DataGrid.Resources>

                </sdk:DataGrid.Resources>
                <sdk:DataGrid.RowGroupHeaderStyles>
                    <Style TargetType="sdk:DataGridRowGroupHeader">
                        <Setter Property="PropertyNameVisibility" Value="Collapsed"/>
                        <Setter Property="SublevelIndent" Value="10" />
                    </Style>
                </sdk:DataGrid.RowGroupHeaderStyles>

                <sdk:DataGrid.Columns>
                    <sdk:DataGridTextColumn Binding="{Binding SkU}"  Header="SKU" MinWidth="150" />
                    <sdk:DataGridTextColumn Binding="{Binding ItemDesc}" Header="Product Description" Width="*"/>
                    <sdk:DataGridTextColumn Binding="{Binding CorrectionsDisplay}" Header="Corrections?" />
                    <sdk:DataGridTextColumn Binding="{Binding QtyLocDisplay}" Header="Qty/Loc"/>
                </sdk:DataGrid.Columns>
            </sdk:DataGrid>
        </Grid>
    </DataTemplate>
</Printing:CollectionPrinter.BodyTemplate>

If anyone has had any luck grouping data and printing it using his method, I would greatly appreciate it if you could help me out.