Welcome to FoxLearn
In this video, I'll show you how to insert buttons into GridControl,
as well as how to use GridControl in DevExpress.
Open your Visual Studio, then create a new Windows Forms Application project
After you finish creating a new Windows Forms project, you can right-click on your project, then select "Add DevExpress Item".
Next, Select "New Item" to create a new DevExpress Form
Next, Open your form designer, then drag the GridControl from your visual studio toolbox into your form designer.
The GridControl provides rich capabilities for displaying, shaping and editing data from any data source.
Next, Right click on your project, then add an ADO.NET Entity Data Model to your project.
We will use Entity Framework to retrieve data from the Northwind database.
Entity Framework is an open-source ORM framework for .NET applications supported by Microsoft.
It enables developers to work with data using objects of domain specific classes without focusing on the underlying database tables and columns where this data is stored.
In this video, I'll use the product and category tables in the Northwind database for practice,
then retrieve and display the data into GridControl
After you finish creating the ADO.NET Entity Data Model,
you should see the diagram like in this video, and don't forget to rebuild your project.
Click on the arrow icon on GridControl, then add the DataSource to your GridControl.
Double-click your form to add a Form_Load event handler that allows you to initialize the data source into GridControl.
You can click the Run Designer button on GridControl to attach a RepositoryItemGridLookUpEdit to GridControl that allows you to display the category name.
Select the Repository section, then add a RepositoryItemGridLookUpEdit.
The RepositoryItemLookUpEdit class contains settings specific to the GridLookUpEdit control.
You can access these settings via the editor's GridLookUpEdit.Properties object
And don't forget to set DataSource, display member, and value member to RepositoryItemGridLookUpEdit.
Select the column section, then select the Category column, and set the ColumnEdit property to RepositoryItemGridLookUpEdit
You can easily add a search box to GridControl that allows you to filter data in any column.
You can also filter data by column, remove any column or group data by column with GridControl
To add a button to GridControl, you can use the RepositoryItemButtonEdit.
The RepositoryItemButtonEdit class provides properties that allow you to access the button collection,
specify the button's appearance,
define textbox visibility and availability.
It also provides ButtonClick and ButtonPressed event that can be handled to respond to click events.
If you want to change the look and feel of DevExpress Forms, you can use the DevExpress Project Settings.
If you want to add an image into the RepositoryItemButtonEdit you should change the Kind property to Glyph,
then add an image to the ImageOptions property
Thank you for watching this video and don't forget to subscribe to my channel