|
| 1 | +<Window x:Class="AnnualSalesReportDemoUsingGrid.MainWindow" |
| 2 | + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 3 | + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
| 4 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 5 | + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
| 6 | + xmlns:syncfusion="http://schemas.syncfusion.com/wpf" |
| 7 | + xmlns:local="clr-namespace:AnnualSalesReportDemoUsingGrid" |
| 8 | + xmlns:syncfusionskin="clr-namespace:Syncfusion.SfSkinManager;assembly=Syncfusion.SfSkinManager.WPF" |
| 9 | + syncfusionskin:SfSkinManager.Theme="{syncfusionskin:SkinManagerExtension ThemeName=Windows11Light}" |
| 10 | + mc:Ignorable="d" |
| 11 | + Title="SalesReportApp" Height="670" Width="1000"> |
| 12 | + <Window.DataContext> |
| 13 | + <local:SalesReportViewModel/> |
| 14 | + </Window.DataContext> |
| 15 | + <Window.Resources> |
| 16 | + <Style TargetType="syncfusion:GridHeaderCellControl"> |
| 17 | + <Setter Property="FontWeight" Value="DemiBold"/> |
| 18 | + </Style> |
| 19 | + <local:ColorConverter x:Key="colorConverter"/> |
| 20 | + <local:PercentageConverter x:Key="converter"/> |
| 21 | + <local:BoolToImageConverter x:Key="boolToImageConverter"/> |
| 22 | + <Style x:Key="rowStyle1" TargetType="syncfusion:VirtualizingCellsControl"> |
| 23 | + <Setter Property="Background" Value="{Binding Converter={StaticResource colorConverter}}" /> |
| 24 | + </Style> |
| 25 | + </Window.Resources> |
| 26 | + <Grid> |
| 27 | + <Grid.RowDefinitions> |
| 28 | + <RowDefinition Height="130"/> |
| 29 | + <RowDefinition/> |
| 30 | + </Grid.RowDefinitions> |
| 31 | + <Grid.ColumnDefinitions> |
| 32 | + <ColumnDefinition/> |
| 33 | + <ColumnDefinition Width="300"/> |
| 34 | + </Grid.ColumnDefinitions> |
| 35 | + <StackPanel Grid.Row="0" Orientation="Vertical"> |
| 36 | + <Grid> |
| 37 | + <Grid.ColumnDefinitions> |
| 38 | + <ColumnDefinition/> |
| 39 | + <ColumnDefinition Width="200"/> |
| 40 | + </Grid.ColumnDefinitions> |
| 41 | + <TextBlock x:Name="label" Text="Sales Report 2025" FontSize="28" FontWeight="Bold"/> |
| 42 | + <syncfusion:SplitButtonAdv x:Name="splitbutton" Label="Export" Grid.Column="1" FontSize="16" Height="30" Width="150" SizeMode="Normal" SmallIcon="/Images/export.png" HorizontalAlignment="Right" VerticalAlignment="Top"> |
| 43 | + <syncfusion:DropDownMenuGroup> |
| 44 | + <syncfusion:DropDownMenuItem HorizontalAlignment="Left" Header="Annual Report" Command="{Binding AnnualReportCommand}" CommandParameter="{Binding ElementName=dataGrid}"/> |
| 45 | + <syncfusion:DropDownMenuItem HorizontalAlignment="Left" Header="Quarterly Report" Command="{Binding QuarterlyReportCommand}" CommandParameter="{Binding ElementName=quarterlyReportsGrid}"/> |
| 46 | + <syncfusion:DropDownMenuItem HorizontalAlignment="Left" Header="Monthly Report" Command="{Binding MonthlyReportCommand}" CommandParameter="{Binding ElementName=monthlyReportsGrid}"/> |
| 47 | + </syncfusion:DropDownMenuGroup> |
| 48 | + </syncfusion:SplitButtonAdv> |
| 49 | + </Grid> |
| 50 | + <Grid Margin="10,10,0,0"> |
| 51 | + <Grid.ColumnDefinitions> |
| 52 | + <ColumnDefinition Width="30"/> |
| 53 | + <ColumnDefinition Width="150"/> |
| 54 | + <ColumnDefinition Width="20"/> |
| 55 | + <ColumnDefinition /> |
| 56 | + </Grid.ColumnDefinitions> |
| 57 | + <Image Grid.Column="0" Source="/Images/products.png"/> |
| 58 | + <TextBlock Grid.Column="1" Text="Total No of Prducts : " FontSize="16" FontWeight="DemiBold" VerticalAlignment="Center"/> |
| 59 | + <TextBlock Grid.Column="2" Text="15" FontSize="16" FontWeight="DemiBold" VerticalAlignment="Center" /> |
| 60 | + </Grid> |
| 61 | + <Grid Margin="10,10,0,0"> |
| 62 | + <Grid.ColumnDefinitions> |
| 63 | + <ColumnDefinition Width="30"/> |
| 64 | + <ColumnDefinition Width="150"/> |
| 65 | + <ColumnDefinition Width="120"/> |
| 66 | + <ColumnDefinition Width="30"/> |
| 67 | + <ColumnDefinition Width="170"/> |
| 68 | + <ColumnDefinition Width="120"/> |
| 69 | + <ColumnDefinition /> |
| 70 | + </Grid.ColumnDefinitions> |
| 71 | + <Image Grid.Column="0" Source="/Images/estimate.png"/> |
| 72 | + <TextBlock Grid.Column="1" Text="Esitimated Sales : " FontSize="16" FontWeight="DemiBold" VerticalAlignment="Center"/> |
| 73 | + <TextBlock Grid.Column="2" Text="{Binding EstimatedSales, StringFormat=C}" FontSize="16" FontWeight="DemiBold" VerticalAlignment="Center"/> |
| 74 | + <Image Grid.Column="3" Source="/Images/total_sales.png"/> |
| 75 | + <TextBlock Grid.Column="4" Text="Total Sales Achieved : " FontSize="16" FontWeight="DemiBold" VerticalAlignment="Center"/> |
| 76 | + <TextBlock Grid.Column="5" Text="{Binding TotalSales, StringFormat=C}" FontSize="16" FontWeight="DemiBold" VerticalAlignment="Center" HorizontalAlignment="Left"/> |
| 77 | + </Grid> |
| 78 | + </StackPanel> |
| 79 | + <GroupBox x:Name="groupbox" Header="Annual Product Sales Report" Margin="10" FontSize="16" FontWeight="DemiBold" Grid.RowSpan="2" Grid.Row="1"> |
| 80 | + <syncfusion:SfDataGrid x:Name="dataGrid" |
| 81 | + AutoGenerateColumns="False" |
| 82 | + ColumnSizer="Star" |
| 83 | + RowHeight="30" |
| 84 | + GridLinesVisibility="Horizontal" |
| 85 | + HeaderLinesVisibility="Horizontal" |
| 86 | + ItemsSource="{Binding Reports}"> |
| 87 | + <syncfusion:SfDataGrid.Columns> |
| 88 | + <syncfusion:GridTextColumn MappingName="ProductName" HeaderText="Product Name"/> |
| 89 | + <syncfusion:GridCurrencyColumn MappingName="EstimatedSales" HeaderText="Estimated Sales"/> |
| 90 | + <syncfusion:GridCurrencyColumn MappingName="SalesAchieved" HeaderText="Sales Achieved" Width="150"> |
| 91 | + <syncfusion:GridCurrencyColumn.CellTemplate> |
| 92 | + <DataTemplate> |
| 93 | + <Grid> |
| 94 | + <Grid.ColumnDefinitions> |
| 95 | + <ColumnDefinition Width="50"/> |
| 96 | + <ColumnDefinition/> |
| 97 | + </Grid.ColumnDefinitions> |
| 98 | + <Image Source="{Binding IsSalesIncreased, Converter={StaticResource boolToImageConverter}, ConverterParameter='AnnualReport'}"/> |
| 99 | + <TextBlock Grid.Column="1" Text="{Binding SalesAchieved, StringFormat=C}" VerticalAlignment="Center"/> |
| 100 | + </Grid> |
| 101 | + </DataTemplate> |
| 102 | + </syncfusion:GridCurrencyColumn.CellTemplate> |
| 103 | + </syncfusion:GridCurrencyColumn> |
| 104 | + <syncfusion:GridTemplateColumn MappingName="SalesPercent" HeaderText="Sales Percent" Width="250"> |
| 105 | + <syncfusion:GridTemplateColumn.CellTemplate> |
| 106 | + <DataTemplate> |
| 107 | + <Grid> |
| 108 | + <Grid.ColumnDefinitions> |
| 109 | + <ColumnDefinition/> |
| 110 | + <ColumnDefinition Width="40"/> |
| 111 | + </Grid.ColumnDefinitions> |
| 112 | + <syncfusion:SfLinearProgressBar Grid.Column="0" Progress="{Binding SalesPercent}" Width="180" Height="10" Padding="2" Minimum="0" Maximum="150" IndicatorCornerRadius="4"> |
| 113 | + |
| 114 | + </syncfusion:SfLinearProgressBar> |
| 115 | + <TextBlock Grid.Column="1" Text="{Binding SalesPercent, Converter={StaticResource converter}}" VerticalAlignment="Center"/> |
| 116 | + </Grid> |
| 117 | + </DataTemplate> |
| 118 | + </syncfusion:GridTemplateColumn.CellTemplate> |
| 119 | + </syncfusion:GridTemplateColumn> |
| 120 | + |
| 121 | + </syncfusion:SfDataGrid.Columns> |
| 122 | + </syncfusion:SfDataGrid> |
| 123 | + </GroupBox> |
| 124 | + <StackPanel Grid.Column="1" Grid.ColumnSpan="2" Grid.RowSpan="2"> |
| 125 | + <GroupBox Header="Quarterly Report" Margin="10" FontSize="16" FontWeight="DemiBold" > |
| 126 | + <syncfusion:SfDataGrid x:Name="quarterlyReportsGrid" |
| 127 | + AutoGenerateColumns="False" |
| 128 | + RowHeight="30" |
| 129 | + GridLinesVisibility="Horizontal" |
| 130 | + HeaderLinesVisibility="Horizontal" |
| 131 | + ColumnSizer="Star" |
| 132 | + ItemsSource="{Binding QuarterlyReports}"> |
| 133 | + <syncfusion:SfDataGrid.Columns> |
| 134 | + <syncfusion:GridTextColumn MappingName="QuarterName" HeaderText="Quarter Name"/> |
| 135 | + <syncfusion:GridTextColumn MappingName="SalesAchieved" HeaderText="Sales Achieved"> |
| 136 | + <syncfusion:GridTextColumn.CellTemplate> |
| 137 | + <DataTemplate> |
| 138 | + <Grid> |
| 139 | + <Grid.ColumnDefinitions> |
| 140 | + <ColumnDefinition /> |
| 141 | + <ColumnDefinition Width="50"/> |
| 142 | + </Grid.ColumnDefinitions> |
| 143 | + <TextBlock Text="{Binding SalesAchieved, StringFormat=C}" VerticalAlignment="Center"/> |
| 144 | + <Image Grid.Column="1" Source="{Binding IsSalesIncreased, Converter={StaticResource boolToImageConverter}}"/> |
| 145 | + </Grid> |
| 146 | + </DataTemplate> |
| 147 | + </syncfusion:GridTextColumn.CellTemplate> |
| 148 | + </syncfusion:GridTextColumn> |
| 149 | + </syncfusion:SfDataGrid.Columns> |
| 150 | + </syncfusion:SfDataGrid> |
| 151 | + </GroupBox> |
| 152 | + <GroupBox Header="Monthly Report" FontSize="16" Margin="10,0,10,10" FontWeight="DemiBold" > |
| 153 | + <syncfusion:SfDataGrid x:Name="monthlyReportsGrid" |
| 154 | + AutoGenerateColumns="False" |
| 155 | + ColumnSizer="Star" |
| 156 | + RowHeight="30" |
| 157 | + RowStyle="{StaticResource rowStyle1}" |
| 158 | + GridLinesVisibility="Horizontal" |
| 159 | + HeaderLinesVisibility="Horizontal" |
| 160 | + ItemsSource="{Binding MonthlyReports}"> |
| 161 | + <syncfusion:SfDataGrid.Columns> |
| 162 | + <syncfusion:GridTextColumn MappingName="MonthName" HeaderText="Month"/> |
| 163 | + <syncfusion:GridTextColumn MappingName="SalesAchieved" HeaderText="Sales Achieved"/> |
| 164 | + </syncfusion:SfDataGrid.Columns> |
| 165 | + </syncfusion:SfDataGrid> |
| 166 | + </GroupBox> |
| 167 | + </StackPanel> |
| 168 | + |
| 169 | + </Grid> |
| 170 | +</Window> |
0 commit comments