Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't write value to model when change comes from model. #315

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class TreeDataGridTextCell : TreeDataGridCell

private string? _value;
private TextBox? _edit;
private bool _modelValueChanging;
private TextTrimming _textTrimming = TextTrimming.CharacterEllipsis;
private TextWrapping _textWrapping = TextWrapping.NoWrap;
private TextAlignment _textAlignment = TextAlignment.Left;
Expand All @@ -54,7 +55,7 @@ public string? Value
get => _value;
set
{
if (SetAndRaise(ValueProperty, ref _value, value) && Model is ITextCell cell)
if (SetAndRaise(ValueProperty, ref _value, value) && Model is ITextCell cell && !_modelValueChanging)
cell.Text = _value;
}
}
Expand Down Expand Up @@ -109,7 +110,17 @@ protected override void OnModelPropertyChanged(object? sender, PropertyChangedEv
base.OnModelPropertyChanged(sender, e);

if (e.PropertyName == nameof(ITextCell.Value))
Value = Model?.Value?.ToString();
{
try
{
_modelValueChanging = true;
Value = Model?.Value?.ToString();
}
finally
{
_modelValueChanging = false;
}
}
}
}
}
Loading