Steven Kirk
a899185afb
Update data validation from EffectiveValue.
Requires `ValueEntry`/`BaseValueEntry` to be available to `EffectiveValue<T>`.
Also change the tests to only test values coming back from the model in the style binding tests, as they don't work when setting local values currently. This will be fixed later.
4 years ago
Steven Kirk
98fa10416f
Use same logic for typed and untyped observers.
However we still need to split the observers into two classes because otherwise we can't implement both `IObservable<T>` and `IObservable<object?>` on the same object.
4 years ago
Steven Kirk
d787a72f7f
Initial impl of data validation for styled properties.
Currently only local value bindings implemented.
4 years ago
Steven Kirk
994897a023
Initialize EffectiveValue with inherited value.
Fixes #10345
4 years ago
Steven Kirk
3e81ed8fbc
Revert to LocalValue when animation completes.
Fixes #10255 .
4 years ago
Steven Kirk
fcf1ce74c9
Use TryGetEffectiveValue.
For consistency with the other methods.
4 years ago
Steven Kirk
15a0fd6a3f
ClearLocalValue => ClearValue.
It no longer just clears the local value, and the method on `AvaloniaObject` is called simply `ClearValue` so makes sense to use the same naming here.
4 years ago
Steven Kirk
8741b7e410
Fix IsSet with SetCurrentValue.
And add unit tests.
4 years ago
Steven Kirk
19078979e3
Initial implementation of SetCurrentValue.
4 years ago
Steven Kirk
467ef300bf
Remove unneeded method.
4 years ago
Steven Kirk
17c3291c80
Remove StyledPropertyBase class.
Originally `StyledPropertyBase` was the base class for `StyledProperty` and `AttachedProperty` however #1499 made `AttachedProperty` derive directly from `StyledProperty` meaning that there is no longer any need for a separate `StyledPropertyBase` class.
4 years ago
Steven Kirk
e074a70187
Refactored style invalidation/removal.
4 years ago
Steven Kirk
326dac2328
Refactored how we switch control themes.
Instead of simply wiping all control themes and styles that are applied to a control, we can now just remove the `ValueFrame`s which relate to the control theme that was changed.
To do this, added `ValueFrame.FramePriority` which encodes both the `BindingPriority` and source of the frame (style, control theme, templated parent control theme).
4 years ago
Steven Kirk
086c2c7e70
Don't apply styling in TopLevel ctor.
Applying styling in the constructor isn't a good idea as demonstrated by #8549..
Instead apply styling when showing a window, or if it's needed call `ApplyStyling` manually, e.g. in unit tests.
Fixes #8549
4 years ago
Steven Kirk
5a13453b9d
Cache property metadata in effective value.
Decreases the number of metadata lookups needed. Previously we were doing two lookups on construction now we're only doing one.
4 years ago
Steven Kirk
ae72b81af9
Remove empty frames.
In doing so, merged `ValueStore.OnBindingCompleted` into `OnValueEntryRemoved` as they were doing the same thing.
4 years ago
Steven Kirk
061f01ac3a
Prevent exception when removing value.
Calling `DisposeAndRaiseUnset` can cause a nested reevaluation of property values.
4 years ago
Steven Kirk
d6ea0778a7
Make IsEvaluating re-entrancy friendly.
4 years ago
Steven Kirk
980790705b
Remove unused variables/parameters.
4 years ago
Steven Kirk
e2c6444ae3
Removed unused method.
4 years ago
Steven Kirk
ba4bfc36f8
Go direct to ValueStore for untyped GetValue.
Avoids a virtual call in the case of styled properties.
4 years ago
Steven Kirk
9b2d9be1fa
Correctly unsubscribe animation value entries.
4 years ago
Steven Kirk
20d85df87c
Simplify unset effective value removal.
4 years ago
Steven Kirk
bd357e08dd
Make EffectiveValue responsible for unsubscribing.
4 years ago
Steven Kirk
a1830b79b5
Raise correct inheritance value change.
When raising `PropertyChanged` due to setting the inheritance parent, use the closest value in the inheritance tree rather than the furthest.
4 years ago
Steven Kirk
bda4a4b964
Include inherited/default values in diagnostic.
4 years ago
Steven Kirk
2144f920be
Re-evaluate all properties if necessary.
Even if the frame's activation state has changed to false.
4 years ago
Steven Kirk
dd5a7c93b9
Re-evaluate all properties if necessary.
When re-evaluating a single property, if the frame activation state changes when unsubscribing from inactive frames then we need to re-evaluate all properties.
4 years ago
Steven Kirk
12f72ddd61
Re-evaluate all properties if necessary.
When re-evaluating a single property, if the frame activation state changes then we need to re-evaluate all properties.
4 years ago
Steven Kirk
9367f8b24d
Refactor binding IValueEntry into base class.
Too many gotchas in implementing binding entries, we'll take the performance hit of a few virtual method calls.
4 years ago
Steven Kirk
d14ff72eab
Unsubscribe inactive bindings.
4 years ago
Steven Kirk
1e1d40134d
Slightly optimized ReevaluateEffectiveValue.
4 years ago
Steven Kirk
0c4aae061b
Special-case frames with one entry.
Seems it's slightly faster to re-evaluate the single value in this case.
4 years ago
Steven Kirk
8f98c2ae76
Store direct property bindings in ValueStore.
We already have a place to store them in the `_localValueBindings` list, so use that rather than having a separate `_directBindings` list in `AvaloniaObject`.
4 years ago
Steven Kirk
31e6bb4f72
Fix evaluation in presence of multiple animation frames.
4 years ago
Steven Kirk
988e26ed9b
Use new AvaloniaPropertyDictionary.
4 years ago
Steven Kirk
a98772cf92
Remove assertion.
Due to #8549 .
4 years ago
Steven Kirk
caf5686777
Remove IValueFrame.
And use the concrete `ValueFrame` (renamed from `ValueFrameBase`) as this was the only implementation of the interface.
4 years ago
Steven Kirk
0119cf1af1
Fix a couple of inheritance bugs.
With associated unit tests.
4 years ago
Steven Kirk
2377dca2d1
Tweak naming.
4 years ago
Steven Kirk
a49a01c94b
Fix DataContext notifications.
4 years ago
Steven Kirk
18caac12ca
Don't start values unnecessarily.
4 years ago
Steven Kirk
fb3e9d71b7
Implemented coercion.
4 years ago
Steven Kirk
483bbd2e26
Refactored inheritance.
To remove `InheritanceFrame` - it was unneeded, we can just point to the nearest ancestor value store with inherited values.
4 years ago
Steven Kirk
72308f1f37
Use custom binary search in ValueStore.
4 years ago
Steven Kirk
79115bd199
Don't add duplicate frames.
4 years ago
Steven Kirk
71785b73d8
Initial refactor of AvaloniaObject value store.
Most (but not all) tests passing, all features mostly implemented exception coercion.
4 years ago