The Syncfusion® native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
I can only align the headers with this code I can''t seem to align the data in the rest of the grid. Please help!
I am trying what I have seen posted out there here is my procedure...
Private Sub AddCellFormattingColumnStyles2(ByVal grid As DataGrid, ByVal handler As FormatCellEventHandler)
Dim ts As DataGridTableStyle
ts = New DataGridTableStyle
Dim dt As DataTable
dt = CType(grid.DataSource, DataTable)
ts.MappingName = dt.TableName
Dim j As Integer
j = 0
Do While (j < dt.Columns.Count)
Dim cs As DataGridFormattableTextBoxColumn
cs = New DataGridFormattableTextBoxColumn(j)
cs.Alignment = HorizontalAlignment.Right
cs.MappingName = dt.Columns(j).ColumnName
cs.HeaderText = dt.Columns(j).ColumnName
''cs.Alignment = HorizontalAlignment.Right
''cs.Width = -1
AddHandler cs.SetCellFormat, handler
ts.GridColumnStyles.Add(cs)
j = (j + 1)
Loop
grid.TableStyles.Clear()
grid.TableStyles.Add(ts)
Dim z As Int32
z = 0
For z = 0 To dt.Columns.Count - 1
grid.TableStyles(0).GridColumnStyles(z).ReadOnly = True
Select Case z
Case 0
grid.TableStyles(0).GridColumnStyles(z).Width = 250
''grid.TableStyles(0).GridColumnStyles(z).Alignment = HorizontalAlignment.Right
Case Else
grid.TableStyles(0).GridColumnStyles(z).Width = 150
''grid.TableStyles(0).GridColumnStyles(z).Alignment = HorizontalAlignment.Right
End Select
Next
grid.TableStyles(0).AllowSorting = False
grid.TableStyles(0).SelectionBackColor = System.Drawing.Color.Gold
End Sub