Cannot set direct property 'IsPaneOpen' in 'SplitView' because the style has an activator.
See original GitHub issueDescribe the bug
Unhandled exception. System.InvalidOperationException: Cannot set direct property ‘IsPaneOpen’ in ‘SplitView.adaptive’ because the style has an activator.
Unhandled exception. System.InvalidOperationException: Cannot set direct property 'IsPaneOpen' in 'SplitView.adaptive' because the style has an activator.
at Avalonia.Styling.Setter.Avalonia.Styling.ISetter.Instance(IStyleInstance instance, StyledElement target) in /_/src/Avalonia.Base/Styling/Setter.cs:line 74
at Avalonia.Styling.StyleBase.Attach(StyledElement target, IStyleActivator activator, FrameType type) in /_/src/Avalonia.Base/Styling/StyleBase.cs:line 116
at Avalonia.Styling.Style.TryAttach(StyledElement target, Object host, FrameType type) in /_/src/Avalonia.Base/Styling/Style.cs:line 77
at Avalonia.StyledElement.ApplyStyle(IStyle style, IStyleHost host, FrameType type) in /_/src/Avalonia.Base/StyledElement.cs:line 790
at Avalonia.StyledElement.ApplyStyles(IStyleHost host) in /_/src/Avalonia.Base/StyledElement.cs:line 783
at Avalonia.StyledElement.ApplyStyles(IStyleHost host) in /_/src/Avalonia.Base/StyledElement.cs:line 778
at Avalonia.StyledElement.ApplyStyling() in /_/src/Avalonia.Base/StyledElement.cs:line 380
at Avalonia.StyledElement.OnAttachedToLogicalTreeCore(LogicalTreeAttachmentEventArgs e) in /_/src/Avalonia.Base/StyledElement.cs:line 814
at Avalonia.StyledElement.OnAttachedToLogicalTreeCore(LogicalTreeAttachmentEventArgs e) in /_/src/Avalonia.Base/StyledElement.cs:line 828
at Avalonia.StyledElement.OnAttachedToLogicalTreeCore(LogicalTreeAttachmentEventArgs e) in /_/src/Avalonia.Base/StyledElement.cs:line 828
at Avalonia.StyledElement.OnAttachedToLogicalTreeCore(LogicalTreeAttachmentEventArgs e) in /_/src/Avalonia.Base/StyledElement.cs:line 828
at Avalonia.StyledElement.OnAttachedToLogicalTreeCore(LogicalTreeAttachmentEventArgs e) in /_/src/Avalonia.Base/StyledElement.cs:line 828
at Avalonia.StyledElement.Avalonia.Controls.ISetLogicalParent.SetParent(ILogical parent) in /_/src/Avalonia.Base/StyledElement.cs:line 475
at Avalonia.StyledElement.SetLogicalParent(IList children) in /_/src/Avalonia.Base/StyledElement.cs:line 881
at Avalonia.StyledElement.LogicalChildrenCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) in /_/src/Avalonia.Base/StyledElement.cs:line 526
at Avalonia.Visual.LogicalChildrenCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) in /_/src/Avalonia.Base/Visual.cs:line 392
at Avalonia.Collections.AvaloniaList`1.NotifyAdd(T item, Int32 index) in /_/src/Avalonia.Base/Collections/AvaloniaList.cs:line 700
at Avalonia.Collections.AvaloniaList`1.Add(T item) in /_/src/Avalonia.Base/Collections/AvaloniaList.cs:line 205
at Avalonia.Controls.ContentControl.ContentChanged(AvaloniaPropertyChangedEventArgs e) in /_/src/Avalonia.Controls/ContentControl.cs:line 128
at Avalonia.Controls.ContentControl.<>c.<.cctor>b__4_0(ContentControl x, AvaloniaPropertyChangedEventArgs e) in /_/src/Avalonia.Controls/ContentControl.cs:line 45
at Avalonia.AvaloniaObjectExtensions.<>c__DisplayClass16_0`1.<AddClassHandler>b__0(AvaloniaPropertyChangedEventArgs e) in /_/src/Avalonia.Base/AvaloniaObjectExtensions.cs:line 414
at System.Reactive.AnonymousObserver`1.OnNextCore(T value) in /_/Rx.NET/Source/src/System.Reactive/AnonymousObserver.cs:line 67
at System.Reactive.ObserverBase`1.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/ObserverBase.cs:line 34
at System.Reactive.Subjects.Subject`1.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/Subjects/Subject.cs:line 145
at Avalonia.AvaloniaProperty`1.NotifyChanged(AvaloniaPropertyChangedEventArgs`1 e) in /_/src/Avalonia.Base/AvaloniaProperty`1.cs:line 65
at Avalonia.AvaloniaObject.RaisePropertyChanged[T](AvaloniaProperty`1 property, Optional`1 oldValue, BindingValue`1 newValue, BindingPriority priority, Boolean isEffectiveValue) in /_/src/Avalonia.Base/AvaloniaObject.cs:line 662
at Avalonia.PropertyStore.EffectiveValue`1.SetAndRaiseCore(ValueStore owner, StyledPropertyBase`1 property, T value, BindingPriority priority) in /_/src/Avalonia.Base/PropertyStore/EffectiveValue`1.cs:line 194
at Avalonia.PropertyStore.EffectiveValue`1.SetLocalValueAndRaise(ValueStore owner, StyledPropertyBase`1 property, T value) in /_/src/Avalonia.Base/PropertyStore/EffectiveValue`1.cs:line 68
at Avalonia.PropertyStore.ValueStore.SetValue[T](StyledPropertyBase`1 property, T value, BindingPriority priority) in /_/src/Avalonia.Base/PropertyStore/ValueStore.cs:line 205
at Avalonia.AvaloniaObject.SetValue[T](StyledPropertyBase`1 property, T value, BindingPriority priority) in /_/src/Avalonia.Base/AvaloniaObject.cs:line 329
at Avalonia.Controls.ContentControl.set_Content(Object value) in /_/src/Avalonia.Controls/ContentControl.cs:line 56
at BehaviorsTestApplication.Views.MainWindow.!XamlIlPopulate(IServiceProvider, MainWindow) in /Users/wieslawsoltes/Documents/GitHub/AvaloniaBehaviors/samples/BehaviorsTestApplication/Views/MainWindow.axaml:line 6
at BehaviorsTestApplication.Views.MainWindow.!XamlIlPopulateTrampoline(MainWindow)
at BehaviorsTestApplication.Views.MainWindow.InitializeComponent() in /Users/wieslawsoltes/Documents/GitHub/AvaloniaBehaviors/samples/BehaviorsTestApplication/Views/MainWindow.axaml.cs:line 19
at BehaviorsTestApplication.Views.MainWindow..ctor() in /Users/wieslawsoltes/Documents/GitHub/AvaloniaBehaviors/samples/BehaviorsTestApplication/Views/MainWindow.axaml.cs:line 12
at BehaviorsTestApplication.App.OnFrameworkInitializationCompleted() in /Users/wieslawsoltes/Documents/GitHub/AvaloniaBehaviors/samples/BehaviorsTestApplication/App.axaml.cs:line 19
at Avalonia.Controls.AppBuilderBase`1.Setup() in /_/src/Avalonia.Controls/AppBuilderBase.cs:line 289
at Avalonia.Controls.AppBuilderBase`1.SetupWithLifetime(IApplicationLifetime lifetime) in /_/src/Avalonia.Controls/AppBuilderBase.cs:line 148
at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 208
at BehaviorsTestApplication.Program.Main(String[] args) in /Users/wieslawsoltes/Documents/GitHub/AvaloniaBehaviors/samples/BehaviorsTestApplication/Program.cs:line 14
To Reproduce Steps to reproduce the behavior:
<Style Selector="SplitView.adaptive">
<Setter Property="IsPaneOpen" Value="False" />
</Style>
Expected behavior
No exceptions.
Screenshots
Desktop (please complete the following information):
- OS: MacOS
- Version master, 11.0.999-cibuild0026718-beta
Additional context Add any other context about the problem here.
Issue Analytics
- State:
- Created 9 months ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
SplitView
Represents a container with two views; one view for the main content and another view that is typically used for navigation commands.
Read more >News
Add new (readonly) ItemFocusVisualStyle dependency property which will be re-created if one of these properties are changed: OpenPaneLength , ...
Read more >Responsive Web | PDF | Windows 10 | Mobile App
Windows 10 includes new controls such as the calendar and split view. ... By default, your app uses resources that have a light...
Read more >XAML – Bruno Sonnino
When you are using the MVVM pattern, at some time, you have to send data ... We must set the DataContext property in...
Read more >Universal Windows Platform Complete Solution
To set the icon of the “SplitView.Pane”, we have used a custom style of Radio Button. In the Radio. Button, there is a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@maxkatz6
Why is this a direct property? Can all you maintainers please have a deep discussion about this and document the outcome? I think several direct properties should not actually be direct. This should be resolved in 11.0 API.
Instead, direct properties should be reserved only for “data” as you put it which includes content, read-only collections and that’s about it (I’m sure there are a few exceptions though).
https://github.com/AvaloniaUI/Avalonia/discussions/9719#discussioncomment-4471230
That’s good at least
We are using
ControlTheme
everywhere, and those themes often contains activatable styles. Our use case is actually low-level controls (e.g.Button
) which appear within the templates of high-level controls, and the selectors are something like^[Foo=bar] /template/ #SomeButton
.I understand the problems that come with setting direct properties from this context, but since we never wanted to remove these values, only to switch between multiple different options, that has never been a problem for us.