* #19962 Add AXAML Source Information to debug Builds
* SimplifyXamlSourceInfo
* Add XamlSourceInfo for as many elements as possible
* Add tests to confirm XamlSourceInfo is set for all types
* Remove property only added for debugging during development
* update skipped test so it runs (even though it doesn't yet pass)
* Wrap XamlAstNewClrObjectNode instead of XamlAstObjectNode, run transformer late
* Remove unsupported value types from the More_Resources_Get_XamlSourceInfo_Set
* Fix Document property not being set in runtime parser
* Add a dedicated CreateSourceInfo parameter for RuntimeXamlLoaderConfiguration, instead of reusing DesignMode
* Inherit real XamlValueWithManipulationNode, move actual manipulation to a separate class
* Fix group transformers by unwrapping manipulation nodes first
* minor Resource related test change
* Update public API as agreed
* Add new failing tests for the dictionaries
* Fix randomly failing tests, that depend on the test order
* Fix assert
* Rename AvaloniaXamlResourceTransformer
* Emit XamlSourceInfo from AvaloniaXamlResourceTransformer
* Rename AvaloniaXamlIlResourceTransformer for consistency
* Cleanup comments
* Remove XamlSourceInfoValueWithManipulationNode, use standard XamlValueWithManipulationNode
* Add new RuntimeXamlLoaderDocument.Document property
* Use UriBuilder trick to support unix paths on windows
* Add private AttachedProperty for avalonia objects, instead of always using weak table
* Fix wrong UriBuilder usage and add more test assets
* Fix "Invalid URI" exception
---------
Co-authored-by: KimHenrik <kimhenrik@outlook.de>
Co-authored-by: Max Katz <maxkatz6@outlook.com>
* Introduce a universal IGlyphTypeface implementation that does not rely on any platform implementation
* Revert changes
* Fix Android
* Make the test happy
* Fix build
* Update baseline
* Fix naming
* Fix headless
* Move interfaces to dedicated files
Make GlyphTypeface.GlyphCount an integer
* Fix GlyphCount
* Make IGlyphTypeface NotClientImplementable
* Make sure we cache platform typefaces by their desired name, style, weight and stretch
* Update baseline
* Only use IGlyphTypeface
* Fix Android
* Try to clear the buffer before we encode somethimg
* Add needed test font
* Add more unit tests
* Reduce allocations
* Remove Direct2D1 test files
* More tests
* More complete table implementations
* More adjustments
* Use batch APIs
* Handle invalid timestamps
* Update baseline
* Introduce a CharacterToGlyphMap struct for faster access
* Remove AggressiveInlining
* Remove AggressiveInlining
* Make the head table optional for legacy fonts
* Remove Load method. Fix TextBlockTests
* Fix nullables
* Remove redundant folder
* Update Api baseline
* revert diff helper changes
* revert changes
* Use bare minimum font for Headless platform and introduce a test font manager that uses the Inter font for testing.
* Add missing font file for Headless platform
---------
Co-authored-by: Gillibald <stebner@avaloniaui.net>
Co-authored-by: Julien Lebosquain <julien@lebosquain.net>
* Update to xunit.v3
* Little more progress
* More fixes
* Keep VSTest supported
* Adjust Nuke
* Few fixes
* Fix for xunit 2
* Fix GetData override
* Adjust
* Use MTP for xunit 2
* Fix test
* Better fix
* --no-progress
* Few more fixes
* no progress
* Fix test
* Better fix
* TRX
* Move to Directory.Build.props
* Unify on MTP v2
* Update
* Update to stable
* 1.0.1
* 1.0.2
* Fix some warnings
* Fix more warnings
* Fix more warnings
* Update ncrunch config.
* Tidy up reflection and multi-binding APIs:
- Move `BindingBase` and `MultiBinding` into Avalonia.Base
- `BindingBase` becomes a true base class for all bindings, and contains only the `Instance` method
- Properties common between reflection and compiled bindings are moved into `StandardBindingBase`
- `Binding` is moved to Avalonia.Base and renamed to `ReflectionBinding`
- A compatibility shim for `Binding` remains in Avalonia.Markup
- Remove `IBinding` and `IBinding2`
- Remove `ITreeDataTemplate's usage of `InstancedBinding`
- Remove `NativeMenuBarPresenter`s usage of `InstancedBinding`
- Remove `InstancedBinding` as it is now unused
This required an update to the DataGrid submodule: cell data validation has been temporarily removed as this used `InstancedBinding`.
* `Instance()` => `CreateInstance()`.
The use of "Instance" as a verb is quite unusual apparently ;)
* Seal classes where appropriate.
* Seal classes where appropriate.
* Remove `StandardBindingBase`.
Simply duplicate the members in reflection and compiled binding classes.
* Delete deleted submodule directory.
* Add missing attribute.
Fixes compile error.
* Fix reference to removed class.
* Update suppressions.
* Enable nullability in UnitTests
* Enable nullability in Base.UnitTests
* Enable nullability in Markup.UnitTests
* Enable nullability in Markup.Xaml.UnitTests
* Support Design.PreviewWith for any previewing content
* ApplyDesignModeProperties should use bindings
* Add support for IDataTemplate PreviewWith
* Add new members as agreed on API review
* ApplyDesignModeProperties probably should be privateapi
* Add xml comments
* Extract Design.CreatePreviewWithControl and move it out of DesignerSupport project
* Several fixes, add tets
* Update API diff
* wip
* Add DesignModeTests, move relevant tests to this class
* Restore methods accepting control, add IStyle target overload
* Restore Design.SetPreviewWith(AvaloniaObject, Control)
* `SetPreviewWith(any, Control? control)` should accept nullable control
* Add `SetDataContext(IDataTemplate control, object? value)`
* Better Obsolete message
* Remove netstandard2.0 from almost all projects
* Fix duplicated target frameworks in unit tests
* Fix DesignerSupport tests
* Fix Designer.HostApp packaging
* Build ControlCatalog.Desktop on CI
* Fix another bad auto merge
* Fix LeakTests duplicated target frameworks
* Don't hardcode target framework in DesignerSupportTests
* Feat: Add unit test for RelativePanel.
The ScrollViewer's scrollbar does not display correctly.
* Fix: RelativePanel calculation error
The ScrollViewer's scrollbar does not display correctly.
* Fix XamlTypeExtensionNode not being handled on the x:DataType transformer
* Add testt with complex DataType
* Make vm:MainWindowViewModel+TestItem nested type generic on BindingDemo
* Implement AVLN2208 diagnostic - ItemContainerInsideTemplate
* Add AVLN2208 tests
* Enable AVLN2208 as an error in the repository globally
* Fix invalid ListBoxItem inside of DataTemplate in devtools
* Add failing style test without selector
* Fix XAML target type of style without selector
* Address review
* Throw for style without selector in ControlTheme
* Add failing test for TemplateBinding inside custom control template
* Fix TemplateBinding XAML compilation error for custom IControlTemplate
---------
Co-authored-by: Max Katz <maxkatz6@outlook.com>
* Try to infer DataContext type from #named binding nodes
* Try to infer DataContext type from $parent binding nodes
* Use new syntax in the repo (Rider still marks it as an error)
* Add tests ensuring type casing still works
* Fix $parent regression
* Make new tests StringSyntax compatible
* feat: Allow use of (Classes.`classname`) syntax on Style and ControlTheme Setter elements
* feat: Add Selector validation
* test: Check binding Classes in Setter
* Implement AvaloniaObject on ResourceProvider
* ColorPaletteResources and ColorPaletteResourcesCollection should inherit ResourceProvider
* Use ResourceProvider in tests too
* Adjust API diff
---------
Co-authored-by: Steven Kirk <grokys@users.noreply.github.com>
The typo causes the resources `implicitSharedInstance1` and `implicitSharedInstance2` are both always `AvaloniaProperty.UnsetValue`, where `Assert.Same` passes.
* Update BindingBase.Instance signature.
- Swap `target` and `targetProperty` order to make it consistent with other similar methods
- Make `targetProperty` nullable as it will need to be null for `MultiBinding`
* IBinding2.Instance needs to accept a null target property.
It will need to be null for `MultiBinding`.
* Attach needs to accept a null target property.
It will need to be null for `MultiBinding`.
* Initial implementation of MultiBindingExpression.
* Fix failing template binding test.
Only publish unset value if we've already published a value.
* Enabled nullability annotations.
* Added passing test for #16084.
* Remove obsolete API usages.
* Bind to Tag not Text.
Prevents test passing when it shouldn't. See https://github.com/AvaloniaUI/Avalonia/pull/16219#discussion_r1665466968
* Handle DoNothing in MultiBindingExpression.
* Add InheritDataTypeFromAttribute and use it in TemplateBinding
* Add failing tests for TemplateBinding depending on a scope
* Update XamlX and RoslynTypeSystem
* Add missing interface implementations
* Improve errors readability in XamlAvaloniaPropertyHelper
* Use more specific TryGetCorrectlyTypedValue overloads
* Finally, respect InheritDataTypeFromAttribute in the AvaloniaProperty parser
* Add some docs
* Output better exception
* Update XamlX
* Add missing docs
* Add attribute to well known types
* Add Correctly_Resolve_TemplateBinding_In_Theme_Detached_Template test and fix ColorPicker usage
---------
Co-authored-by: Steven Kirk <grokys@users.noreply.github.com>
* Add tests for binding negation operator.
Expected results come from 11.0.x branch.
* Unset and null need to be distinct.
Also remove `ExpressionNode.Reset` as it was doing unneeded stuff and should just be the same as `SetSource(AvaloniaProperty.UnsetValue, null);`.
* Make ExpressionNode.OnSourceChanged accept null.
The previous design assumed that a source of `null` was an invalid input to all types of expression nodes. It turned out that there was a single exception to this rule: the `!` operator can in fact operate on a null value. With this new design we instead have to explicitly check for a null value in every override of `OnSourceChanged ` except in `LogicalNotNode`.
Due to this change, we also have to distinguish between `null` and `(unset)` in `ExpressionNode.SetSource` as well.
Fixes#16071
* Fix comment.
* Add failing test for #16113.
* Convert delegate to ICommand in style setter.
When compiling a binding to e.g. `Button.Command` in a style `Setter`, we were not converting `XamlIlClrMethodPathElementNode` to `XamlIlClrMethodAsCommandPathElementNode` as we were only testing whether the property that the binding was being assigned to is an `ICommand`.
If we detect that we're assigning the binding to a `Setter.Value` then we need to look in the `Setter.Property` to see check whether the property is an `ICommand` too.
Fixes#16113
* Reduce allocations in XamlIlRuntimeHelpers
* Iterate XAML parents without allocations
* Use IDeferredContent for XAML deferred content to reduce allocations
* Use function pointer in DeferredTransformationFactory
* Reuse parent resource nodes if possible for deferred content
* Fix function pointer usage with SRE
* Added failing test for #14753.
* Don't try to publish on non-running binding.
This can happen in cases like #14653 where:
1. An event is raised with 2 binding expression subscribers
2. The first subscriber causes the 2nd subscriber to be stopped
3. The second subscriber is called from the event, even though it has been stopped (as the event list was cached at step 1)
4. It calls `PublishValue` causing an exception
Easiest to just do nothing in `PublishValue` when this scenario happens.
* Add .NET 8 target to packable projects
* Update test projects
* Update sample projects to target .NET 8
* Update main Avalonia package to target .NET 8 as well
* Remove MSBuildEnableWorkloadResolver hack and some minor change
* Use net8.0 in nuke build as well
* Pin 8.0.0 SDK
* Adjust API validation
* Pin a valid version
* Remove net461 target from Avalonia package
* Remove unused net6.0 target from Avalonia.Designer.HostApp
* Adjust API diff
* Update ControlCatalog.Android.csproj
* Remove MSBuildEnableWorkloadResolver
* Fix Browser issues on .NET 8
* Fix .NET 8 error
* Fix merge conflicts
* Replace explicit TFMs in .csproj files with a centralized registry
* Fix merge conflict
* Fix AvsLegacyWindowsTargetFrameworks and add hacks for the tests
* Update XCode project CommandLineArgument
---------
Co-authored-by: Nikita Tsukanov <keks9n@gmail.com>
* Do not defer resources with name registration on them
* Fix transformers order
* Make NameScopeRegistrationVisitor usage more clear
* Reuse NameScopeRegistrationVisitor
* Make NameScopeRegistrationVisitor usage more intuitive