Posts

Showing posts with the label WPF DataGrid

Donate

How To Apply Checkbox Check All To WPF DataGrid Using MVVM Pattern In VB.NET

Image
Good day Gents! In this post, I will demonstrate the VB.NET version on how to create a WPF DataGrid application that has a check all checkbox behavior for selecting all rows using the MVVM Pattern. First is we need to create a .NET WPF Visual Basic project that targets the .NET framework with a project structure similar to the screenshot below. App.config Update your App.config's connection string with your local database connection. <configuration> <startup> <supportedRuntime version= "v4.0" sku= ".NETFramework,Version=v4.5.2" /> </startup> <connectionStrings> <add name= "products" connectionString= "data source=.;Initial Catalog=TestDatabase;Trusted_Connection=True;" providerName= "System.Data.SqlClient" /> </connectionStrings> </configuration> DBUtil.vb The DBUtil class will retrieve records from the database and u

How To Apply Checkbox Check All To WPF DataGrid Using MVVM Pattern

Image
Good day Gents! In this post, I will demonstrate on how to create a WPF DataGrid application that has a check all checkbox behavior for selecting all rows using the MVVM Pattern. First is we need to create a .NET Core WPF project that targets the .NET 7 framework with a project structure similar to the screenshot below. App.config Update your App.config's connection string with your local database connection. <configuration> <connectionStrings> <add name= "products" connectionString= "data source=.;Initial Catalog=TestDatabase;Integrated Security=true;" providerName= "System.Data.SqlClient" /> </connectionStrings> </configuration> DBUtil.cs The DBUtil class will retrieve records from the database and update the discontinued field of a particular product. public static class DBUtil { public static DataTable GetProduct() { DataSet ds = new DataSet(); string q

WPF Custom DataGrid Vertical Scrolling Slow With Thousands Of Records

Image
Hello And Good Evening! I was tasked by our software architect to investigate an existing project of our company as to why a custom WPF DataGrid's vertical scrolling is slow, lagging or sluggish. This project will collect and show thousands of records that composed mostly hardware and software assets and it's related attributes. The DataGrid control used in the project is a custom class that inherits the DataGrid class with user-defined functions that performs specific tasks. public class clsCustomDataGrid : DataGrid { public clsCustomDataGrid() { //More codes here... } //More codes here... } We tried setting the virtualizations through the XAML but no luck. The scrolling is still lagging both using the mouse wheel and vertical scroll bar. After several attempts of researching through the forums and trying out the recommended answer, the solution that fixed the vertical scrolling issue is to set the virtualizations of the column, row, VirtualizingPanel a

WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And VB.NET

Image
Good day guys! Here's the VB.NET version of this article WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And C#.NET which is a CRUD (Create,Update and Delete) application using the DataGrid control, ADO.NET Entity Framework 6.x and Model–View–Viewmodel(MVVM) architectural pattern. The project structure and the logic were derived from that article except that this application incorporates Visual Basic.NET/VB.NET as the programming language. I. Project Setup 1. Create a table in your database called Students using the script from this post WPF CRUD With DataGrid, Entity Framework And C#.NET . 2. Create a WPF Project and add four folders called DataAccess, Model, View and ViewModel. The project structure may resemble with the screenshot provided below. II. Coding The Model and Repository Class 1. Inside the Model folder, add an ADO.NET Entity Data Model object that connects to the Students table in your database. On my part, I named it StudentModel . 2. Fo

Donate