Makes the `StyledElement.Classes` and `Flyout.FlyoutPresenterClasses` properties readonly. Adds a transformer to the XAML compiler to convert attribute syntax classes setters to collection syntax so that they will be added to the existing `Classes` object.
Prevents an unneeded allocation of a `Classes` object when setting `Classes` from XAML.
- Make `SetAndRaise` accept a `DirectPropertyBase` instead of an `AvaloniaProperty`: only direct properties can be changed by this method
- Remove `priority` from `RaisePropertyChanged`: direct property changes are always with `LocalValue` priority
- Remove `Optional` and `BindingValue` wrappers from `RaisePropertyChanged`: concrete values must always be supplied
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).
- Removes the `IStyler` service and the `Styler` implementation
- Moves the logic for applying styles and control themes into `StyledElement`
- Removes the style `TryAttach` method from the public API
- Removes style caching for now - this will need to be added back
Now tries to simulate an application with a lot of styles applied at different points in the logical tree.
Make `StyledElement.ApplyStyling` a public API in order to do this.
The WPF equivalent (`Style`) is in `FrameworkElement` so it would make sense. Will also make stuff a lot easier and removes the need for an `IThemed` interface.
* 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>
Instead of each control listening to its parent `ResourcesChanged` event, use the logical tree to propagate `ResourcesChanged` events:
- When attaching to the logical tree, piggyback on the `AttachedToLogicalTree` traversal
- At other times, propagate by calling `NotifyResourcesChanged`
Split resource nodes into two types:
- `IResourceHost` represents controls and `Application`
- `IResourceProvider` represents resource dictionaries and styles, these are owned by `IResourceHost`s
Dynamic resources are now always resolved from an `IResourceHost`: if an `IResourceProvider` doesn't have a host then a dynamic resource in the resource provider will not be resolved. Resource providers no longer have a `ResourcesChanged` event, instead they notify their `IResourceHost` owner of a resource change by calling the `NotifyHostedResourcesChanged` method.
In the case of #3708, the sanity check fails because the parent call to `SetParent` hasn't yet completed - it's the setting of `InheritanceParent` on the parent that causes the child to get attached.