Hi Wisej,
When setting DataGridView.RowTemplate.DefaultCellStyle.WrapMode=True, Default Column.DefaultCellStyle.NullValue = True not active.
Why is it?
Best regards.
Hi Huynh,
issue #2349 is fixed in the latest Wisej development build (2.1.84).
Best regards
Frank
It’s a bug. When you set the Me.DataGridView1.DefaultCellStyle.WrapMode = DataGridViewTriState.True it initializes the Me.DataGridView1.DefaultCellStyle and when inheriting the cell style it end up overriding (incorrectly) the column’s CellStyle only for the NullValue. Logged as #2349.
Two workarounds:
Public Class MyDataGridViewCheckBoxCell Inherits DataGridViewCheckBoxCell Public Overrides Function GetInheritedStyle(includeVisualProperties As Boolean) As DataGridViewCellStyle Dim style = MyBase.GetInheritedStyle(includeVisualProperties) style.NullValue = True Return style End Function End Class Public Class MyDataGridViewCheckBoxColumn Inherits DataGridViewCheckBoxColumn Public Sub New() MyBase.New(New MyDataGridViewCheckBoxCell) End Sub End Class
2. Create a custom cell and assign it:
Public Class MyDataGridViewCheckBoxCell Inherits DataGridViewCheckBoxCell Public Overrides Function GetInheritedStyle(includeVisualProperties As Boolean) As DataGridViewCellStyle Dim style = MyBase.GetInheritedStyle(includeVisualProperties) style.NullValue = True Return style End Function End Class Me.DataGridView1.Columns(2).CellTemplate = New MyDataGridViewCheckBoxCell
Please login first to submit.