In GridDataControl, you can use the CellMarginsInfo class to describe the Cell’s Padding, TextMargins and also BorderMargins. Using the CellMarginsInfo you can define each side of the cell’s margin individually. Margin sides that are not initialized, inherit default values from the base style. Generally the properties Left, Right, Top and Bottom are used to set the respective margin values.
Following code illustrates the usage of CellMarginsInfo to set GridDataControl Cell’s Padding, TextMargins and also BorderMargins.
Here, two CellMarginsInfo definitions (CellMargin and CellBorderMargin) are created and applied to the VisibleColumns ”Empmobileno”, “Mail ID” and “Designation” using the ColumnStyle property. GridDataColumnStyle is used to set the Padding, TextMargins and BorderMargins values. CellBorderMargin is applied for BorderMargins, and CellMargin is applied for Padding and TextMargins.
The following screenshot illustrates the output for the above code in the GridDataControl.
Here you can notice that the Cell Padding and TextMargins are applied for “Mail ID” and “Empmobileno” columns that are actually left aligned and BorderMargins applied for “Designation” column that is actually right aligned. You can also note that they vary from the cells of other VisibleColumns as padding or Margins are set for those columns where cells in other columns have default value.
This page will automatically be redirected to the sign-in page in 10 seconds.