Create Custom GridView Cells in C#.NET
The Kettic DataGridView C#.NET component allows users of the control easily create custom grid cells to GridView in Windows Forms application. There are a lot of visual cells which all inherit from KetticGridCellElement are included in the DataGridView control, such as, header cells, indent cells, command cells, summary cells, group content cells, data cells, etc. All the visual cells are compatible with the usage of GridView component. So users can easily create custom grid cells when you need to implement more specific and custom scenario.
How to Create Custom Grid Cells in C#.NET
To create a custom grid data cell by using the Kettic GridView component, we can use the C# code as below, which creates a C# class for the gird cell derived from the KetticDataGridCellElement.
And then, we can create the KetticProgressBarElement for the custom grid data cells and add the progress bar as a child of the custom grid data cell. This is accomplished by override the method, CreateChildElements, by using the C# code as below.
After finishing the above step, we can update the progress bar for the custom grid data cells based on the value that are assigned by overriding the method, SetContentCore.
Now, we can simply style the custom grid cell by apply the style of KetticDataGridCellElement to it. This is achieved by defining the ThemeEffectiveType of the KetticDataGridCellElement style as the C# below.
For the convenience of users of control, the GridView allows users reuse the created custom grid data cells in C# Windows Forms projects. The created custom cells can also be used in different rows or columns when they are compatible with the custom cells, which can be defined through the ApplyCompatible property for columns.
Extend the Custom Grid Cell in C#.NET
The Kettic GridView allows users of the control to extend the custom grid data cell by adding a button into the custom data cell and subscribing the custom cell to the Click event. And we can use the button to restart the progress bar by setting the custom cell value to 0. The following are the steps that shows how to achieve this.
UI Controlsfor Windows Forms.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls