The MindFusion Forums
MindFusion.Reporting >> WPF >> Fields 'drop' across page when sub data range used
https://mindfusion.eu/Forum/YaBB.pl?num=1318586382

Message started by Tim99 on Oct 14th, 2011 at 9:59am

Title: Fields 'drop' across page when sub data range used
Post by Tim99 on Oct 14th, 2011 at 9:59am
I am trying to produce a report which has a number of entries from a related table listed down the page. It should look something like this;

Field1    SubItem1    Field2   Field3
            SubItem2
            SubItem3

Field1   SubItem1    Field2    Field3
           SubItem2

I have used a DataRange within the main data template to list the SubItems. This all works except that the subsequent fields after the sub items start at the same level as the last sub item. The report I get looks like this;

Field1    SubItem1    
            SubItem2
            SubItem3    Field2   Field3

Field1   SubItem1    
           SubItem2     Field2    Field3

This looks very odd and is not how I would like it layed out. I have experimented with using the UseDesignOrder propertry and this does resolve the problem if there is only one set of Sub Items but it does not work where there are many sets of sub items.

I have created a sample project to demonstrate the issue. Here is an example of the code;

Code (]
       <r:Page>
           <r:DataRange DataSource="{Binding Matters}" Size="100%,1" Background="LightBlue">
               <r:DataRange.ItemTemplate>
                   <DataTemplate>
                       <r:ItemContainer VerticalAlignment="Top" UseDesignOrder="False">
                           <r:Label Location="0,0" Size="5%,5" Text="[Ref):

" VerticalAlignment="Top"/>
                           <r:DataRange Location="5%,0" Size="20%,1%" DataSource="{Binding Customer}" Background="LightGray">
                               <r:DataRange.ItemTemplate>
                                   <DataTemplate>
                                       <r:ItemContainer>
                                           <r:Label Location="0,0" Size="20%, 5" Text="[Ref]"/>
                                           <r:Label Location="20%,0" Size="80%, 5" Text="[Name]"/>
                                       </r:ItemContainer>
                                   </DataTemplate>
                               </r:DataRange.ItemTemplate>
                           </r:DataRange>
                           <r:Label Text="[Bal3]" Size="5%,5" Location="25%,0"/>
                           <r:DataRange Location="30%,0" Size="25%,1%" DataSource="{Binding Staff}" Background="LightSkyBlue">
                               <r:DataRange.ItemTemplate>
                                   <DataTemplate>
                                       <r:ItemContainer>
                                           <r:Label Location="0,0" Size="20%, 5" Text="[Code]" />
                                           <r:Label Location="20%,0" Size="80%, 5" Text="[Name]"/>
                                       </r:ItemContainer>
                                   </DataTemplate>
                               </r:DataRange.ItemTemplate>
                           </r:DataRange>
                           <r:Label Text="[Bal1]"  Location="55%,0" Size="10%,5" />
                           <r:Label Text="[Bal2]"  Location="65%,0" Size="10%,5" />
                           <r:Label Text="{Binding Bal3}"  Location="75%,0" Size="10%,5" />
                       </r:ItemContainer>
                   </DataTemplate>
               </r:DataRange.ItemTemplate>
           </r:DataRange>
       </r:Page>


I can email the entire project over to you if that would help.

Thanks for your help.

Tim.

Title: Re: Fields 'drop' across page when sub data range
Post by Meppy on Oct 14th, 2011 at 11:27am
Is it possible to send me your database so that I don't have to recreate it locally in order to investigate this problem?

Regards,
Meppy

Title: Re: Fields 'drop' across page when sub data range
Post by Meppy on Oct 17th, 2011 at 2:24pm
Hi,

The current behavior of the data ranges is by design. The idea is that when a report generation is is run, the actual data range height becomes different from its design-time height. To prevent overlapping all subsequent elements in the report are offset vertically. Imagine the case when you have two data ranges in the report design - one above the other (which was our initial assumption of a natural report flow) - when the first data range is run, the second data range gets offset so that the data ranges do not overlap. This inherent behavior can now be turned on and off through the new CollideOnRun property of the DataRange class. You can set this property to False to make the report layout to no longer automatically adjust the position of items after a data range is run.

The updated version of the Reporting component can be downloaded from here. You can use the new property in XAML:

[code]<r:DataRange CollideOnRun="False">[/code]
Kind regards,
Meppy

The MindFusion Forums » Powered by YaBB 2.6.11!
YaBB Forum Software © 2000-2024. All Rights Reserved.