Open blackmole opened 1 month ago
So what happens is this chain: TextCell.Value
is changed --> TreeDataGridTextCell.Value
is changed which sets TextCell.Text
which tries to convert the text back to the enum. And which is unnecessary because the TextCell.Value
is already correct.
Not sure what the clean solution is, but I guess it might work to change the TextCell.Text
setter to:
set
{
if (value != _value?.ToString())
Value = (T?)Convert.ChangeType(value, typeof(T));
}
Setup: TreeDataGrid with a column that contains an enum.
Action: The model raises a PropertyChanged event for the enum.
Expected behavior: The TreeDataGrid updates the cell to the new enum value.
Observed behavior: A System.InvalidCastException is triggered.
Workaround tried: I used an IValueConverter for the conversion between the enum and strings. Did not change anything.
Apparently the way the data is displayed normally and the way the data is updated are different. Example for this issue: https://github.com/blackmole/AvaloniaComboBoxEnum