Browse Source

Disallow OneTime bindings in setters.

I'm not sure what should happen here when the style deactivates and is re-activated. Should the one-time binding trigger again? Or should it only trigger on first activation? Wait and see what the use-case for this is (if any).
pull/3636/head
Steven Kirk 6 years ago
parent
commit
dbe03e090a
  1. 8
      src/Avalonia.Styling/Styling/PropertySetterBindingInstance.cs

8
src/Avalonia.Styling/Styling/PropertySetterBindingInstance.cs

@ -34,6 +34,14 @@ namespace Avalonia.Styling
_target = target;
_styledProperty = property;
_binding = binding.Initiate(_target, property);
if (_binding.Mode == BindingMode.OneTime)
{
// For the moment, we don't support OneTime bindings in setters, because I'm not
// sure what the semantics should be in the case of activation/deactivation.
throw new NotSupportedException("OneTime bindings are not supported in setters.");
}
_inner = new Inner(this);
}

Loading…
Cancel
Save