Articles in this section
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 grid, 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

 

Screenshot

Show the progress bar based on the cell value

 

Samples:

C#: Update progressbar value_CS

VB: Update progressbar value_VB

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied