Articles in this section
Category / Section

How to display "..." in a cell while the whole text is not enough wide in WinForms GridControl, GridGroupingControl and GridDataBoundGrid?

1 min read

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. In a GridControl to set the trimming for an entire column, use the following code example.

Using GridModel


// GridControl
this.gridControl1.ColStyles[2].Trimming = StringTrimming.EllipsisWord;
// GridGroupingControl
this.gridGroupingControl1.TableDescriptor.Columns["ColumnName"].Appearance.AnyRecordFieldCell.WrapText = false;
this.gridGroupingControl1.TableDescriptor.Columns["ColumnName"].Appearance.AnyRecordFieldCell.Trimming = StringTrimming.EllipsisWord;
// GridDataBoundGrid
this.gridDataBoundGrid1.Binder.InternalColumns["ColumnName"].StyleInfo.Trimming = StringTrimming.EllipsisWord;


' GridControl 
Me.gridControl1.ColStyles(2).Trimming = StringTrimming.EllipsisWord
' GridGroupingControl 
Me.gridGroupingControl1.TableDescriptor.Columns("ColumnName").Appearance.AnyRecordFieldCell.WrapText = False
Me.gridGroupingControl1.TableDescriptor.Columns("ColumnName").Appearance.AnyRecordFieldCell.Trimming = StringTrimming.EllipsisWord
' GridDataBoundGrid  
Me.gridDataBoundGrid1.Binder.InternalColumns("ColumnName").StyleInfo.Trimming = StringTrimming.EllipsisWord

Using QueryCellInfo


//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;


'Hook the event to set the trimming style to the column
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



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

You can refer to our WinForms DataGrid 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 DataGrid 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?
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment