diff --git a/src/Avalonia.Controls.TreeDataGrid/Models/TreeDataGrid/TextCell.cs b/src/Avalonia.Controls.TreeDataGrid/Models/TreeDataGrid/TextCell.cs index 13e16b4d..fe721f5b 100644 --- a/src/Avalonia.Controls.TreeDataGrid/Models/TreeDataGrid/TextCell.cs +++ b/src/Avalonia.Controls.TreeDataGrid/Models/TreeDataGrid/TextCell.cs @@ -49,7 +49,16 @@ public TextCell( public string? Text { get => _value?.ToString(); - set => Value = (T?)Convert.ChangeType(value, typeof(T)); + set{ + if (string.IsNullOrEmpty(value)) + { + Value = default(T?); + } + else + { + Value = (T?)Convert.ChangeType(value, typeof(T)); + } + } } public T? Value