This sample demonstrates how to bind a Syncfusion Blazor DataGrid to an ObservableCollection data source. The implementation shows how collection-level changes are automatically reflected in the grid when items are added to or removed from the underlying data source. This approach is useful for applications that need to keep the UI synchronized with dynamic in-memory data without manually rebinding or refreshing the DataGrid after every collection update.
- Uses the Syncfusion Blazor DataGrid as the primary data presentation component.
- Binds the grid data source to an
ObservableCollection, enabling automatic UI updates when the collection changes. - Demonstrates notification-based data updates for create and delete operations performed on the underlying collection.
- Uses strongly typed data models from the project's
Datafolder to populate grid records.
- Visual Studio 2022 or Visual Studio Code
Visual Studio 2022
- Clone or download this repository.
- Open
BindWithObservableCollection.slnin Visual Studio 2022. - Restore the NuGet packages.
- Build the solution.
- Run the application.
- Navigate to the page that hosts the Syncfusion Blazor DataGrid sample.
- Perform record add or delete operations and observe how the grid automatically reflects changes made to the underlying observable collection.
Visual Studio Code
- Open the repository folder in Visual Studio Code.
- Open the integrated terminal.
- Navigate to the project directory.
dotnet restore
dotnet runPages/— Contains the page that renders and hosts the Syncfusion Blazor DataGrid sample.Data/— Contains the data model and observable collection source used by the grid.Program.cs— Configures application services and startup behavior for the Blazor application.
- For general product questions, visit the Syncfusion Community Forum or Syncfusion Support.
- To report an issue specific to this sample, open a GitHub issue in this repository.
- For DataGrid data binding documentation, see: https://help.syncfusion.com/grid-sdk/blazor/data-grid/data-binding/local-data#observable-collection
This is a Syncfusion sample project provided to demonstrate product usage. Review the Syncfusion license terms before using Syncfusion components in your own applications.