<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:l="clr-namespace:MindFusion.Reporting.Wpf.Samples.CS.CustomReportItems"
	xmlns:r="http://mindfusion.eu/reporting/wpf">

	<r:Report x:Key="customItemsReport" MeasureUnit="Millimeter" FontSize="12">
		<r:Page>
			<r:Label Location="2,2" Size="112,8" Text="Sales by Category" FontSize="18" FontWeight="Bold" />
			<r:Label Location="80%,3" Size="100*,6" Text="[Today() @ &quot;dd MMM, yyyy&quot;]" FontSize="14" FontStyle="Italic" TextAlignment="Right" />

			<r:DataRange Location="0%,12" Size="100%,24" DataSource="{Binding Categories}" BorderBrush="#EBD2FF" BorderThickness="1,0,1,1" Margin="0,0,0,5">
				<r:DataRange.ItemTemplate>
					<DataTemplate>
						<r:ItemContainer>
							<r:Label Location="0,0" Size="10,6" Text="[CategoryID]" Background="#EBD2FF" FontWeight="Bold" FontSize="12" Padding="4" VerticalAlignment="Center" />
							<r:Label Location="10,0" Size="100*,6" Text="[CategoryName]" Background="#EBD2FF" FontWeight="Bold" FontSize="12" Padding="4" VerticalAlignment="Center" />

							<r:DataRange Name="SalesRange" Location="10,15" Size="98*,6" Background="#D2D2FA" AlternatingBackground="#FAFAD2">
								<r:DataRange.HeaderTemplate>
									<DataTemplate>
										<r:ItemContainer Size="100%,6">
											<r:Label Location="0%,0" Size="40%,6" Text="Product" VerticalAlignment="Center" Padding="2" FontWeight="Bold" />
											<r:Label Location="40%,0" Size="25%,6" Text="Sales" TextAlignment="Right" VerticalAlignment="Center" Padding="2" FontWeight="Bold" />
											<r:Label Location="70%,0" Size="25%,6" Text="% of Total" VerticalAlignment="Center" Padding="2" FontWeight="Bold" />
										</r:ItemContainer>
									</DataTemplate>
								</r:DataRange.HeaderTemplate>
								<r:DataRange.ItemTemplate>
									<DataTemplate>
										<r:ItemContainer>
											<r:Label Location="0%,0" Size="40%,6" Text="[ProductName]" VerticalAlignment="Center" Padding="2" />
											<r:Label Location="40%,0" Size="25%,6" Text="[ProductSales]" TextFormat="${0:#,##0.00}" FontFamily="Courier New" TextAlignment="Right" VerticalAlignment="Center" Padding="2" />
											<r:CustomReportItem Location="70%,0" Size="30%,6" Value="[Round(100*ProductSales/Sum(&quot;ProductSales&quot;),2)]" Name="myItem">
												<r:CustomReportItem.Template>
													<DataTemplate>
														<Border Margin="2" Padding="2" Background="#23000000">
															<Grid>
																<Grid.ColumnDefinitions>
																	<ColumnDefinition Width="{r:Expression '[this.Tag]*'}" Tag="{Binding}" />
																	<ColumnDefinition Width="{r:Expression '[100-(10+20*2)]*'}" />
																</Grid.ColumnDefinitions>
																<Border Grid.Column="0">
																	<Border.Background>
																		<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
																			<GradientStop Offset="0" Color="Yellow" />
																			<GradientStop Offset="1" Color="Red" />
																		</LinearGradientBrush>
																	</Border.Background>
																</Border>
																<TextBlock Grid.ColumnSpan="2" Text="{r:Expression '[this.DataContext]%'}" VerticalAlignment="Center" Margin="2" />
															</Grid>
														</Border>
													</DataTemplate>
												</r:CustomReportItem.Template>
											</r:CustomReportItem>
										</r:ItemContainer>
									</DataTemplate>
								</r:DataRange.ItemTemplate>
							</r:DataRange>

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

		</r:Page>
	</r:Report>

</ResourceDictionary>