Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to add container(like Grid) in r:datarange (Read 7250 times)
luolishuang
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 40
Joined: Feb 22nd, 2013
How to add container(like Grid) in r:datarange
Feb 22nd, 2013 at 9:13am
Print Post  
How to add container(like Grid) in r:datarange
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: How to add container(like Grid) in r:datarange
Reply #1 - Feb 22nd, 2013 at 9:38am
Print Post  
You can use any WPF FrameworkElement in a report through the CustomReportItem object. The following code illustrates how to embed a Grid panel:

Code
Select All
<r:CustomReportItem Location="5,5" Size="150,40">
	<r:CustomReportItem.Template>
		<DataTemplate>
			<Grid>
				<Grid.ColumnDefinitions>
					<ColumnDefinition />
					<ColumnDefinition />
				</Grid.ColumnDefinitions>
				<Grid.RowDefinitions>
					<RowDefinition />
					<RowDefinition />
					<RowDefinition />
				</Grid.RowDefinitions>
				<Border Background="#10000000">
					<TextBlock Text="Header 1" />
				</Border>
				<Border Background="#10000000" Grid.Column="1">
					<TextBlock Text="Header 2" />
				</Border>
				<TextBlock Text="item 1" Grid.Row="1" />
				<TextBlock Text="item 2" Grid.Row="1" Grid.Column="1" />
				<TextBlock Text="item 3" Grid.Row="2" />
				<TextBlock Text="item 4" Grid.Row="2" Grid.Column="1" />
			</Grid>
		</DataTemplate>
	</r:CustomReportItem.Template>
</r:CustomReportItem> 


Regards,
Meppy
  
Back to top
 
IP Logged
 
luolishuang
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 40
Joined: Feb 22nd, 2013
Re: How to add container(like Grid) in r:datarange
Reply #2 - Feb 25th, 2013 at 12:58am
Print Post  
Only in CustomReportItem? Could it be put in DataRange?

Thanks for you reply!
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: How to add container(like Grid) in r:datarange
Reply #3 - Feb 25th, 2013 at 6:49am
Print Post  
You can add the CustomReportItem containing the Grid to the DataRange object:

Code
Select All
<r:DataRange Size="100%,50" DataSource="...">
	<r:DataRange.ItemTemplate>
		<DataTemplate>
			<r:ItemContainer>

				<r:CustomReportItem>...</r:CustomReportItem>

			<r:ItemContainer>
		</DataTemplate>
	</r:DataRange.ItemTemplate>
</r:DataRange> 


You can also check the CustomReportItems sample installed with the product. It illustrates how to add a WPF Grid object (containing a Border and a TextBlock) to the report.

Regards,
Meppy
  
Back to top
 
IP Logged
 
luolishuang
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 40
Joined: Feb 22nd, 2013
Re: How to add container(like Grid) in r:datarange
Reply #4 - Feb 25th, 2013 at 7:16am
Print Post  
Thanks for help.
  
Back to top
 
IP Logged
 
luolishuang
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 40
Joined: Feb 22nd, 2013
Re: How to add container(like Grid) in r:datarange
Reply #5 - Feb 27th, 2013 at 2:25am
Print Post  
Meppy,

Can the report control (like r:Label) be put in Grid?

Regards,
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: How to add container(like Grid) in r:datarange
Reply #6 - Feb 27th, 2013 at 7:20am
Print Post  
Hi,

Report elements are designed to be used only inside reports, parented in other report elements, or as root elements inside data templates. Even though technically you are able to put report elements (like Label) inside a WPF grid, this really would not yield the expected result.

Regards,
Meppy
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint