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).
Exposed by the previous fix for #8372: re-entrancy in `PropertySetterInstance.Dispose()` is causing detaching a style to call `ClearValue` on the property. Previously this wasn't a problem as `ClearValue` didn't work, but now it is.
(Also added one passing test which tests the same scenario in `PropertySetterBindingInstance` for future coverage)
* Merge core libraries.
Everything below `Avalonia.Controls` into `Avalonia.Base`.
* Move new files to correct place.
* Removed unused dirs/projects,
* Removed outdated references from theme assemblies.
* Merge unit tests to match new assembly layout.
* Fixup test namespaces.
* Make directory match namespace.
* Move files to match namespace.
* Move files to match namespace.
* Fix up incorrect namespace.
`Avalonia.Visuals.Media.Imaging` -> `Avalonia.Media.Imaging`.
* Fix resource URL.
* Removed outdated dependencies.
* Added missing project reference.
* Update test namespaces.
* Fix merge error.
* Fix merge errors.
* Fix bad merge in WindowsInteropTest.csproj.
* Fix up merge errors in csprojs.
* Remove merged tests from nuke.
* Fix up namespace.
* Fix compile error.
* Fix failing tests.
Now that more unit tests are present in Avalonia.Base.UnitTests, general `AvaloniaObject` properties are getting registered. Ignore those.
Co-authored-by: Jumar Macato <16554748+jmacato@users.noreply.github.com>
- Don't use Rx in the styling system. Instead introduces `IStyleActivator` which is like an `IObservable<bool>`-lite in order to cut down on allocations.
- #nullable enable on touched files
When a `TemplateBinding` is used as a `Setter.Value`, then we need to make sure we don't use the `TemplateBinding` itself as the binding because this can cause a memory leak.
Replace `IRequiresTemplateInSetter` with `ISetterValue` which can be used to require a template in the setter for `Control` and can also be used to notify `TemplateBinding` that it's in a setter and so should always clone itself.
Fixes#2420
Previously it wasn't clear which constructor on `InstancedBinding` must be called for a particular binding mode. Refactored the constructors:
- We now have a single public ctor which takes an `ISubject`, as a subject can be used for all binding modes.
- Instanced bindings with other sources such as single values and `IObservables` are now constructed via static methods which only allow the correct sources for that binding mode
The new <Template> is a template that can be used as a setter value,
meaning that the setter will materialize the template each time it sets
the value. Make assigning a control to `Setter.Value` throw an error
indicating that the control should be wrapped in a template.