Hello,
i can not change the font a it's size in sfDataGrid
can some on please help
thanks
Hi Ricardo Abranches,
Thanks for your information.
Your requirement to change the font size in the SfDataGrid control, can be
achieved by update the DataGrid style. For changing the font size of all cells,
you should modify the CellStyle. If you also want to adjust the font size of
the header cells, you can update the HeaderStyle accordingly.
Code Snippet:
|
public Form1() { InitializeComponent(); sfDataGrid1.AutoGenerateColumns = true; sfDataGrid1.AllowFiltering = true; sfDataGrid1.DataSource = new ViewModel().Orders; this.sfDataGrid1.Style.CellStyle.Font.Size = 10; this.sfDataGrid1.Style.HeaderStyle.Font.Size = 10; } |
For further details, please
refer to the attached user guide link, which covers handling "Styles"
and "Conditional Styling."
https://help.syncfusion.com/windowsforms/datagrid/styling#styling-record-cell
https://help.syncfusion.com/windowsforms/datagrid/conditionalstyling#cells
Thanks for your cooperation.
Regards,
Santhosh.G
it worked
Hello,
how can i change the font
i' trying to place a rowstyle based on a columun
Private Sub DataGrid_QueryRowStyle(sender As Object, e As Syncfusion.WinForms.DataGrid.Events.QueryRowStyleEventArgs) Handles DataGrid.QueryRowStyle
If e.RowType = RowType.DefaultRow Then
If (TryCast(e.RowData, OrderInfo)).VerificaLin_Ok = True Then
e.Style.TextColor = Color.Blue
ElseIf (TryCast(e.RowData, OrderInfo)).VerificaLin_Ok = False Then
e.Style.TextColor = Color.Red
End If
End If
End Sub
but it gives errors on the propertys or variavles in bold and underline
i used the expample
https://help.syncfusion.com/windowsforms/datagrid/conditionalstyling?cs-save-lang=1&cs-lang=vb
Styling based on content
Hi Ricardo Abranches,
Thank you for your response.
Regarding your requirement to
change the font in the SfDataGrid control, as mentioned in our previous update,
if you wish to modify the entire DataGrid, you will need to update the DataGrid
style. To change the font for all cells, you should modify the CellStyle. If
you also want to change the font of the header cells, you can update the
HeaderStyle accordingly.
Code Snippet:
|
Public Sub New() InitializeComponent() sfDataGrid1.AutoGenerateColumns = True sfDataGrid1.AllowFiltering = True sfDataGrid1.DataSource = (New ViewModel()).Orders Me.sfDataGrid1.Style.CellStyle.Font.Size = 10 Me.sfDataGrid1.Style.HeaderStyle.Font.Size = 10 Me.sfDataGrid1.Style.HeaderStyle.Font.Facename = "Algerian" Me.sfDataGrid1.Style.CellStyle.Font.Facename = "Algerian" AddHandler sfDataGrid1.QueryRowStyle, AddressOf SfDataGrid1_QueryRowStyle End Sub |
Based on the code snippet you provided, we attempted to replicate the error; however, it worked as expected on our end, and we were unable to replicate the issue.
To assist you further, could you please share more details about the error you encountered? It would be helpful if you could provide specific information, such as the call stack.
For your reference, we've attached a sample. Please review it, and if possible, kindly replicate the issue using the provided sample. This will help us proceed more effectively.
Thank you for your cooperation. We look forward to your
response.
Regards,
Santhosh.G