Category / Section
How to change the progress bar value based on the cell value in WinForms GridGroupingControl?
1 min read
To update the progress bar value based on the cell value in WinForms GridGroupingControl, use the ProgressValue property of GridProgressBarInfo class in the QueryCellStyleInfo event.
C#
//Event Subscription
this.gridGroupingControl1.QueryCellStyleInfo += GridGroupingControl1_QueryCellStyleInfo;
//Event Customization
private void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity == null || e.TableCellIdentity.Column == null)
return;
if (e.TableCellIdentity.Column.Name == "ProgressBarStatus" && e.TableCellIdentity.DisplayElement.Kind == Syncfusion.Grouping.DisplayElementKind.Record)
{
int value;
if (int.TryParse(e.Style.Text, out value))
{
// To set progressbar value based on cellvalue.
e.Style.ProgressBar.ProgressValue = value;
}
}
}
VB
'Event Subscription
AddHandler Me.gridGroupingControl1.QueryCellStyleInfo, AddressOf GridGroupingControl1_QueryCellStyleInfo
'Event Customization
Private Sub GridGroupingControl1_QueryCellStyleInfo(ByVal sender As Object, ByVal e As GridTableCellStyleInfoEventArgs)
If e.TableCellIdentity Is Nothing OrElse e.TableCellIdentity.Column Is Nothing Then
Return
End If
If e.TableCellIdentity.Column.Name = "ProgressBarStatus" AndAlso e.TableCellIdentity.DisplayElement.Kind = Syncfusion.Grouping.DisplayElementKind.Record Then
Dim value As Integer
If Integer.TryParse(e.Style.Text, value) Then
'To set progressbar value based on cellvalue.
e.Style.ProgressBar.ProgressValue = value
End If
End If
End Sub
The screenshot below illustrates the progress bar in GridGroupingControl
Samples: