Browse Source

Fix dev tools property value converter (#14722)

pull/14736/head
Julien Lebosquain 3 years ago
committed by GitHub
parent
commit
353dd1d5c8
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 12
      src/Avalonia.Diagnostics/Diagnostics/Views/PropertyValueEditorView.cs

12
src/Avalonia.Diagnostics/Diagnostics/Views/PropertyValueEditorView.cs

@ -301,13 +301,8 @@ namespace Avalonia.Diagnostics.Views
} }
//HACK: ValueConverter that skips first target update
//TODO: Would be nice to have some kind of "InitialBindingValue" option on TwoWay bindings to control
//if the first value comes from the source or target
private class ValueConverter : IValueConverter private class ValueConverter : IValueConverter
{ {
private bool _firstUpdate = true;
object? IValueConverter.Convert(object? value, Type targetType, object? parameter, CultureInfo culture) object? IValueConverter.Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{ {
return Convert(value, targetType, parameter, culture); return Convert(value, targetType, parameter, culture);
@ -315,13 +310,6 @@ namespace Avalonia.Diagnostics.Views
object? IValueConverter.ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) object? IValueConverter.ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{ {
if (_firstUpdate)
{
_firstUpdate = false;
return BindingOperations.DoNothing;
}
//Note: targetType provided by Converter is simply "object" //Note: targetType provided by Converter is simply "object"
return ConvertBack(value, (Type)parameter!, parameter, culture); return ConvertBack(value, (Type)parameter!, parameter, culture);
} }

Loading…
Cancel
Save