Articles in this section

How to display "..." in cell for WinForms GridControl?

Trimming text


You can show the cell’s content like “…” at the end while it’s not enough to display the whole text, by setting the GridStyleInfo's Trimming property by using QueryCellInfo event in WinForms GridControl.


C#

//Hook the event to set the trimming style to the column
this.gridControl1.QueryCellInfo += gridControl1_QueryCellInfo;

void gridControl1_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
    if(e.ColIndex == 2)
    {
          //Apply trimming for the column
          e.Style.Trimming = StringTrimming.EllipsisWord;
    }
}
VB
'Hook the event to set the trimming style to the column
AddHandler Me.gridControl1.QueryCellInfo, gridControl1_QueryCellInfo

Private Sub gridControl1_QueryCellInfo(ByVal sender As Object, ByVal e As GridQueryCellInfoEventArgs)
    If e.ColIndex = 2 Then
          'Apply trimming for the column
          e.Style.Trimming = StringTrimming.EllipsisWord
    End If
End Sub
The following screenshot illustrates the output.

GridControl with ellipsis word trimming

Figure 1: GridControl with EllipsisWord Trimming


Conclusion

I hope you enjoyed learning about how to display "..." in a cell while the whole text is not enough wide in WinForms GridControl.


You can refer to WinForms GridControl feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms GridControl example to understand how to create and manipulate data.

 

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

 

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

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