Open flarive opened 1 year ago
Hi @flarive Avalonia 11 has complied bindings enabled as default. You can either try to use ReflectionBinding
or you need to specify x:DataType
. See: https://docs.avaloniaui.net/docs/data-binding/compiledbindings
Thanks for your answer... ReflectionBinding doesn't seem to work when used with TemplatedParent. And i'm in this case :(
Known limitations Compiled bindings have some known limitations: Compiled bindings cannot be used to bind to named elements Compiled bindings cannot be used in Styles with RelativeSource set to TemplatedParent (e.g.: {Binding Width, RelativeSource={RelativeSource TemplatedParent}})
And in my case i'm using a MultiBinding. How can i set x:DataType in MultiBinding ?
Don't know if TemplatedParent even is supposed to work outside ControlTemplate. 🤔 Maybe $self or $parent[ToggleButton] is needed.
Hello,
When i was using AvaloniaUI 0.10.x the following style was working :
SelectionControlAssist.Size is an attached property defined like that :
When using 0.11-rc1 i have an exception at runtime :
System.ArgumentException : 'Unable to resolve namespace for type assist:SelectionControlAssist'
à Avalonia.Markup.Xaml.XamlIl.Runtime.XamlIlRuntimeHelpers.XamlTypeResolver.Resolve(String qualifiedTypeName) à Avalonia.Markup.Xaml.Extensions.ResolveType(IServiceProvider ctx, String namespacePrefix, String type) à Avalonia.Markup.Parsers.ExpressionParser.ParseAttachedProperty(AttachedPropertyNameNode node) à Avalonia.Markup.Parsers.ExpressionParser.Parse(CharacterReader& r) à Avalonia.Markup.Parsers.ExpressionObserverBuilder.Parse(String expression, Boolean enableValidation, Funcb0(TSource x)
à System.Linq.Enumerable.SelectListIteratorb__0(IObserver
3 typeResolver, INameScope nameScope) à Avalonia.Data.Binding.CreateExpressionObserver(AvaloniaObject target, AvaloniaProperty targetProperty, Object anchor, Boolean enableDataValidation) à Avalonia.Data.BindingBase.Initiate(AvaloniaObject target, AvaloniaProperty targetProperty, Object anchor, Boolean enableDataValidation) à Avalonia.Data.MultiBinding.<>c__DisplayClass37_0.<Initiate>b__0(IBinding x) à System.Linq.Utilities.<>c__DisplayClass2_0
3.2.MoveNext() à System.Linq.Enumerable.WhereEnumerableIterator
1.ToArray() à Avalonia.Reactive.Operators.CombineLatest2._.Run(IEnumerable
1 sources) à Avalonia.Reactive.Operators.CombineLatest2.Subscribe(IObserver
1 observer) à Avalonia.Reactive.Observable.<>c__DisplayClass2_0`2.0(IObserver1 obs) à Avalonia.Reactive.Observable.<>c__DisplayClass4_0
1.1 obs) à Avalonia.PropertyStore.BindingEntryBase
2.Start(Boolean produceValue) à Avalonia.PropertyStore.BindingEntryBase2.get_HasValue() à Avalonia.PropertyStore.ValueStore.ReevaluateEffectiveValue(AvaloniaProperty property, EffectiveValue current, IValueEntry changedValueEntry, Boolean ignoreLocalValue) à Avalonia.PropertyStore.ValueStore.OnFrameActivationChanged(ValueFrame frame) à Avalonia.Styling.StyleInstance.Avalonia.Styling.Activators.IStyleActivatorSink.OnNext(Boolean value) à Avalonia.Styling.Activators.StyleActivatorBase.ReevaluateIsActive() à Avalonia.Styling.Activators.AndActivator.Avalonia.Styling.Activators.IStyleActivatorSink.OnNext(Boolean value) à Avalonia.Styling.Activators.StyleActivatorBase.ReevaluateIsActive() à Avalonia.Styling.Activators.StyleClassActivator.Avalonia.Controls.IClassesChangedListener.Changed() à Avalonia.Controls.Classes.NotifyChanged() à Avalonia.Controls.Primitives.ToggleButton.UpdatePseudoClasses(Nullable
1 isChecked) à Avalonia.Controls.Primitives.ToggleButton.OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) à Avalonia.Animation.Animatable.OnPropertyChangedCore(AvaloniaPropertyChangedEventArgs change) à Avalonia.AvaloniaObject.RaisePropertyChanged[T](AvaloniaProperty1 property, Optional
1 oldValue, BindingValue1 newValue, BindingPriority priority, Boolean isEffectiveValue) à Avalonia.PropertyStore.EffectiveValue
1.SetAndRaiseCore(ValueStore owner, StyledProperty1 property, T value, BindingPriority priority, Boolean isOverriddenCurrentValue, Boolean isCoercedDefaultValue) à Avalonia.PropertyStore.EffectiveValue
1.SetCurrentValueAndRaise(ValueStore owner, StyledProperty1 property, T value) à Avalonia.PropertyStore.ValueStore.SetCurrentValue[T](StyledProperty
1 property, T value) à Avalonia.AvaloniaObject.SetCurrentValue[T](StyledProperty1 property, T value) à Avalonia.Controls.Primitives.ToggleButton.Toggle() à Avalonia.Controls.ToggleSwitch.Toggle() à Avalonia.Controls.Primitives.ToggleButton.OnClick() à Avalonia.Controls.Button.OnPointerReleased(PointerReleasedEventArgs e) à Avalonia.Input.InputElement.<>c.<.cctor>b__32_9(InputElement x, PointerReleasedEventArgs e) à Avalonia.Reactive.LightweightObservableBase
1.PublishNext(T value) à Avalonia.Interactivity.EventRoute.RaiseEventImpl(RoutedEventArgs e) à Avalonia.Interactivity.EventRoute.RaiseEvent(Interactive source, RoutedEventArgs e) à Avalonia.Interactivity.Interactive.RaiseEvent(RoutedEventArgs e) à Avalonia.Input.MouseDevice.MouseUp(IMouseDevice device, UInt64 timestamp, IInputRoot root, Point p, PointerPointProperties props, KeyModifiers inputModifiers, IInputElement hitTest) à Avalonia.Input.MouseDevice.ProcessRawEvent(RawPointerEventArgs e) à Avalonia.Input.InputManager.ProcessInput(RawInputEventArgs e) à Avalonia.Controls.TopLevel.HandleInput(RawInputEventArgs e) à Avalonia.Win32.WindowImpl.AppWndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam) à Avalonia.Win32.WindowImpl.WndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam) à Avalonia.Win32.Interop.UnmanagedMethods.DispatchMessage(MSG& lpmsg) à Avalonia.Win32.Win32DispatcherImpl.RunLoop(CancellationToken cancellationToken) à Avalonia.Threading.DispatcherFrame.Run(IControlledDispatcherImpl impl) à Avalonia.Threading.Dispatcher.PushFrame(DispatcherFrame frame) à Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken) à Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args) à Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime(AppBuilder builder, String[] args, ShutdownMode shutdownMode) à MyApp.Program.Main(String[] args) dans C:\Users\flarive\Documents\Visual Studio 2022\Projects\Next\MyProgram\Program.cs :ligne 30How can i make it works with 0.11-rc1 please ?
Thanks a lot