|
1 | | -# Developing-a-Student-Attendance-Tracker-Using-WPF-SfDataGrid |
2 | | -The development of a WPF application that helps track student attendance using the powerful and flexible Syncfusion SfDataGrid. This solution is ideal for educational institutions or academic projects that need to monitor attendance in an organized, visual, and interactive way |
| 1 | +# Student Attendance Tracker Using WPF SfDataGrid |
| 2 | + |
| 3 | +The development of a WPF application that helps track student attendance using the powerful and flexible Syncfusion SfDataGrid. This solution is ideal for educational institutions or academic projects that need to monitor attendance in an organized, visual, and interactive way. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +This Student Attendance Tracker is a WPF-based desktop application built with Syncfusion SfDataGrid for managing student attendance across multiple subjects. The application features a dual-tab interface: "All Tab" for viewing all students and "Individual Tab" for tracking specific students monthly. |
| 8 | + |
| 9 | +## Key Features |
| 10 | + |
| 11 | +- **Dual-Tab Interface**: Manage all students or track individual student records by month |
| 12 | +- **Interactive DataGrid**: Edit attendance records with CheckBox columns for present/absent marking |
| 13 | +- **Sorting & Filtering**: Toolbar buttons for organizing and searching attendance data |
| 14 | +- **Date Selection**: Integrated date picker for selecting specific dates |
| 15 | +- **Summary Statistics**: Table summary rows display total students present per subject |
| 16 | +- **Excel Export**: Export individual student monthly records to Excel |
| 17 | +- **Multiple Columns**: GridNumericColumn (ID/Date), GridTextColumn (Names), GridCheckBoxColumn (Attendance), GridTemplateColumn (Custom templates) |
| 18 | +- **Subject Tracking**: Monitors attendance for Mathematics, History, Science, and English |
| 19 | +- **Modern Theme**: Windows 11 Light theme with SfSkinManager for professional appearance |
| 20 | + |
| 21 | +## Code Snippets |
| 22 | + |
| 23 | +### SfDataGrid Definition with Columns |
| 24 | +```xaml |
| 25 | +<syncfusion:SfDataGrid x:Name="dataGrid" |
| 26 | + Grid.Row="2" |
| 27 | + Height="412" |
| 28 | + Width="750" |
| 29 | + Margin="10,0,10,0" |
| 30 | + RowHeight="24" |
| 31 | + ItemsSource="{Binding Students}" |
| 32 | + AllowEditing="True" |
| 33 | + AddNewRowPosition="FixedTop" |
| 34 | + ShowRowHeader="True" |
| 35 | + AddNewRowText="Add New Student details"> |
| 36 | + <syncfusion:SfDataGrid.Columns> |
| 37 | + <syncfusion:GridNumericColumn MappingName="Id" Width="50" AllowEditing="True" NumberDecimalDigits="0"/> |
| 38 | + <syncfusion:GridTextColumn MappingName="Name" Width="150" AllowEditing="False"/> |
| 39 | + <syncfusion:GridCheckBoxColumn MappingName="Mathematics" ColumnSizer="Star" /> |
| 40 | + <syncfusion:GridCheckBoxColumn MappingName="History" ColumnSizer="Star" /> |
| 41 | + <syncfusion:GridCheckBoxColumn MappingName="Science" ColumnSizer="Star"/> |
| 42 | + <syncfusion:GridCheckBoxColumn MappingName="English" ColumnSizer="Star"/> |
| 43 | + </syncfusion:SfDataGrid.Columns> |
| 44 | +``` |
| 45 | + |
| 46 | +### Table Summary Rows with Custom Aggregate |
| 47 | +```xaml |
| 48 | +<syncfusion:SfDataGrid.TableSummaryRows> |
| 49 | + <syncfusion:GridTableSummaryRow ShowSummaryInRow="False" TitleColumnCount="2" Title="No of Students Present in class:" Position="Bottom"> |
| 50 | + <syncfusion:GridSummaryRow.SummaryColumns> |
| 51 | + <syncfusion:GridSummaryColumn Name="Mathematics" |
| 52 | + Format="'{PresentCount:d}'" |
| 53 | + MappingName="Mathematics" |
| 54 | + SummaryType="Custom" |
| 55 | + CustomAggregate="{StaticResource customAggregate}"/> |
| 56 | + <syncfusion:GridSummaryColumn Name="History" |
| 57 | + Format="'{PresentCount:d}'" |
| 58 | + MappingName="History" |
| 59 | + SummaryType="Custom" |
| 60 | + CustomAggregate="{StaticResource customAggregate}"/> |
| 61 | + </syncfusion:GridSummaryRow.SummaryColumns> |
| 62 | + </syncfusion:GridTableSummaryRow> |
| 63 | +</syncfusion:SfDataGrid.TableSummaryRows> |
| 64 | +``` |
| 65 | + |
| 66 | +### Date Picker and Toolbar Controls |
| 67 | +```xaml |
| 68 | +<TextBlock Text="Date:" Height="15" Width="36" HorizontalAlignment="Right"/> |
| 69 | +<syncfusion:SfDatePicker x:Name="datePicker" Width="150" Height="30" HorizontalAlignment="Right" /> |
| 70 | + |
| 71 | +<syncfusion:ToolBarAdv ToolBarName="Settings" Grid.Row="1" Height="30"> |
| 72 | + <Button x:Name="ascButton" ToolTip="Sort Ascending"> |
| 73 | + <Image Source="Images\sort-alpha-up.png" Width="20" Height="20"/> |
| 74 | + </Button> |
| 75 | + <Button x:Name="desButton" ToolTip="Sort Decending"> |
| 76 | + <Image Source="Images\sort-alpha-up-reversed.png" Width="20" Height="20"/> |
| 77 | + </Button> |
| 78 | + <Button x:Name="clearSortButton" ToolTip="Clear Sort"> |
| 79 | + <Image Source="/Images/close.png" Width="20" Height="20"/> |
| 80 | + </Button> |
| 81 | + <Button x:Name="enableFilterButton" ToolTip="Enable Filter"> |
| 82 | + <Image Source="/Images/filter.png" Width="20" Height="20"/> |
| 83 | + </Button> |
| 84 | +</syncfusion:ToolBarAdv> |
| 85 | +``` |
| 86 | + |
| 87 | +### Template Column with Cell Selector |
| 88 | +```xaml |
| 89 | +<syncfusion:GridTemplateColumn MappingName="Mathematics" ColumnSizer="Star" |
| 90 | + CellTemplateSelector="{StaticResource cellTemplateSelector}" |
| 91 | + SetCellBoundValue="True"> |
| 92 | +</syncfusion:GridTemplateColumn> |
| 93 | + |
| 94 | +<DataTemplate x:Key="DefaultTemplate"> |
| 95 | + <CheckBox IsChecked="{Binding Path=Value}" HorizontalAlignment="Center" /> |
| 96 | +</DataTemplate> |
| 97 | + |
| 98 | +<DataTemplate x:Key="AlternateTemplate"> |
| 99 | + <TextBlock Background="DeepSkyBlue" Foreground="White" |
| 100 | + Text="- - - Holiday - - -" TextAlignment="Center" /> |
| 101 | +</DataTemplate> |
| 102 | +``` |
| 103 | + |
| 104 | +### Dual-Tab Interface |
| 105 | +```xaml |
| 106 | +<syncfusion:TabControlExt Name="tabControlExt"> |
| 107 | + <syncfusion:TabItemExt Header="All"> |
| 108 | + <!-- All students attendance grid --> |
| 109 | + </syncfusion:TabItemExt> |
| 110 | + <syncfusion:TabItemExt Header="Individual"> |
| 111 | + <!-- Individual student monthly grid --> |
| 112 | + </syncfusion:TabItemExt> |
| 113 | +</syncfusion:TabControlExt> |
| 114 | +``` |
| 115 | + |
| 116 | +### Individual Student Monthly View |
| 117 | +```xaml |
| 118 | +<syncfusion:SfDataGrid x:Name="monthlyDataGrid" |
| 119 | + Grid.Row="1" |
| 120 | + Height="450" |
| 121 | + Width="750" |
| 122 | + GridLinesVisibility="Vertical" |
| 123 | + Margin="10,0,10,0" |
| 124 | + AutoGenerateColumns="False" |
| 125 | + ItemsSource="{Binding MonthlyRecords}"> |
| 126 | + <syncfusion:SfDataGrid.Columns> |
| 127 | + <syncfusion:GridNumericColumn MappingName="Date" Width="50" NumberDecimalDigits="0"/> |
| 128 | + <syncfusion:GridTextColumn MappingName="Day" Width="150"/> |
| 129 | + <syncfusion:GridTemplateColumn MappingName="Mathematics" ColumnSizer="Star" |
| 130 | + CellTemplateSelector="{StaticResource cellTemplateSelector}" |
| 131 | + SetCellBoundValue="True"> |
| 132 | + </syncfusion:GridTemplateColumn> |
| 133 | + </syncfusion:SfDataGrid.Columns> |
| 134 | +</syncfusion:SfDataGrid> |
| 135 | +``` |
| 136 | + |
| 137 | +## Support and Resources |
| 138 | + |
| 139 | +For more information on Syncfusion SfDataGrid, visit [Syncfusion Documentation](https://www.syncfusion.com/wpf-controls). |
0 commit comments