A WPF desktop application demonstrating a comprehensive school grade sheet system using Syncfusion's SfDataGrid control. This application showcases advanced data grid features including filtering, grouping, sorting, and column management.
This application displays student grades across multiple subjects with comprehensive grade management features. It demonstrates best practices for building data-driven WPF applications with the MVVM (Model-View-ViewModel) pattern.
- 20 Student Records: Pre-populated sample data with student information and grades
- Multiple Subjects: Math, Science, History, English, and Art
- Comprehensive Scoring: Assignment, Quiz, Exam, and Project scores
- Calculated Final Grade: Automatic calculation of final grades (average of all scores)
- Comments: Teacher comments for each student record
- Click "Hide Columns" to toggle visibility of specific columns
- Popup displays checkboxes for each column
- Use "Hide All" and "Show All" buttons for bulk operations
- First column (StudentID) is frozen for easy reference
- Click "Filter" to filter data by specific criteria
- Select from filter conditions: Contains,Equals, Not Equals.
- Enter search text to filter records in real-time
- Clear filters with the "x" button to reset view
- Click "Group" to group data by selected column
- Choose any column from the dropdown to organize data hierarchically
- Clear grouping to return to flat list view
- AutoExpandGroups feature shows all group details by default
- Click "Sort" to sort data by selected column
- Choose sort order: Ascending or Descending
- Toggle sort order button to quickly reverse direction
- Clear sort to return to default order
Each grade record contains:
- ID: Student ID (1-20)
- StudentName: Full name of the student
- SubjectName: Subject being graded (Math, Science, History, English, Art)
- AssignmentScore: Assignment score (0-100)
- QuizScore: Quiz score (0-100)
- ExamScore: Exam score (0-100)
- ProjectScore: Project score (0-100)
- Grade: Calculated final grade (average of all four scores)
- Comments: Teacher feedback
The application comes with 20 pre-populated student records:
| Student Name | Subject | Assignment | Quiz | Exam | Project | Final Grade |
|---|---|---|---|---|---|---|
| Alice Johnson | Math | 90 | 85 | 88 | 92 | 88.75 |
| Bob Smith | Science | 78 | 82 | 80 | 85 | 81.25 |
| Charlie Brown | History | 85 | 80 | 87 | 90 | 85.50 |
| Diana Prince | English | 92 | 88 | 91 | 95 | 91.50 |
| Evan Davis | Art | 88 | 80 | 85 | 87 | 85.00 |
| ... | ... | ... | ... | ... | ... | ... |
All 20 students are loaded with diverse score ranges and comments.
- .NET Runtime: .NET 8.0 or higher
- Operating System: Windows 10 or later
- Memory: Minimum 512 MB RAM
- Visual Studio: Visual Studio 2022 (for development)
- Install .NET 8.0 SDK or later
- Install Visual Studio 2022 with WPF workload
- Open
DataGridWPF.slnin Visual Studio 2022 - Right-click the project in Solution Explorer and select "Set as Startup Project"
- Press
F5or click Debug > Start Debugging - The application window will launch with sample data pre-loaded
βββ MainWindow.xaml # Main application UI
βββ MainWindow.xaml.cs # Code-behind for main window
βββ App.xaml # Application configuration
βββ App.xaml.cs # Application code-behind
βββ DataGridWPF.csproj # Project file
βββ Helper/
β βββ DataGridBehavior.cs # Behavior for DataGrid events
β βββ GridColumnInfo.cs # Column information model
β βββ RelayCommand.cs # ICommand implementation
βββ Model/
β βββ Grade.cs # Grade data model
βββ ViewModel/
βββ GradeSheetViewModel.cs # MVVM ViewModel
Grade.cs - Data model representing a student's grade record
- Implements
INotifyPropertyChangedfor data binding - Provides
CalculateFinalGrade()method for grade calculation
GradeSheetViewModel.cs - Handles UI logic and data manipulation
- Manages DataGrid state (visibility, filters, groups, sorts)
- Implements all command handlers
- Provides sample data population
DataGridBehavior.cs - Extends DataGrid functionality
- Handles unbound columns (StudentID combination, calculated Grade)
- Manages filter events and real-time filtering
GridColumnInfo.cs - Represents column metadata
- Tracks column visibility state
- Maps between column names and display names
- Window titled "School Gradesheet" opens (800x450 pixels)
- Toolbar appears with 4 control buttons: Hide Columns, Filter, Group, Sort
- DataGrid displays all 20 student records with 8 columns
- First column (StudentID) is frozen, showing combined name and ID
- Data is immediately interactive
Hiding Columns:
- Click "Hide Columns" β popup appears with checkboxes
- Uncheck desired columns β they disappear from grid
- Re-check columns β they reappear
Filtering:
- Click "Filter" β enter search text and select condition
- Grid updates in real-time to show matching records
- Click "x" to clear filter β all records reappear
Grouping:
- Click "Group" β select column from dropdown
- Grid organizes data hierarchically by selected column
- Click "x" to clear grouping β returns to flat view
Sorting:
- Click "Sort" β select column and sort direction
- Grid re-orders based on selection
- Toggle button to reverse sort order
Combined Operations:
- All features work together: hide columns while filtering, group while sorting, etc.
- No data is lost; all operations are reversible
The application uses the following NuGet packages:
| Package | Version | Purpose |
|---|---|---|
| Syncfusion.SfGrid.WPF | 33.2.15 | WPF DataGrid Control |
| Syncfusion.Tools.WPF | 33.2.15 | UI Controls (ButtonAdv, ComboBoxAdv) |
| Microsoft.Xaml.Behaviors.Wpf | Latest | XAML Behaviors framework |
- Uses
GradeSheetViewModelas the primary view model - All commands are
RelayCommandimplementations - Data binding through XAML and code-behind
ItemsSourcebound toGradesObservableCollection- Column visibility bound to
GridColumnslist - Filter/Group/Sort bound to respective descriptions
INotifyPropertyChangedimplementation ensures UI updates- Filter events trigger grid refresh automatically
- Unbound columns calculated on-demand for Grade and StudentID
- Verify .NET 8.0 is installed:
dotnet --version - Ensure all NuGet packages are restored:
dotnet restore
- Check that Syncfusion NuGet packages are properly installed
- Verify license key if using premium Syncfusion features
- Check Debug output for binding errors
- Ensure Microsoft.Xaml.Behaviors.Wpf is installed
- Verify DataGridBehavior is properly attached to the grid
- Check that ViewModel is set as DataContext
For issues or questions about Syncfusion controls, visit: