-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot set direct property 'IsPaneOpen' in 'SplitView' because the style has an activator. #9800
Comments
By design. It's not possible to set a dynamic value to the direct property via styles. It is possible to remove 'adaptive' class from the SplitView, but it's not possible to remove direct property value. In 0.10 it was undefined behavior. Also, with 11.0 it's possible to create a ControlTheme, and set setter to the direct property without any activators/style-classes. |
Potentially we want to have a compile-time error for this scenario as well. |
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).
That's good at least |
Today I updated to a nightly build of Avalonia and hit this problem multiple times in our application. In our case, we are setting I'm with @robloo here. If you are going to crash the application (or emit a compile error) when setting certain property types from certain styles, then the use of those property types needs to be VERY carefully considered. I would go even further than robloo's suggestion: in light of these changes, Of course there are ways to work around these issues, such as creating a proxy @grokys I believe this change was related to the |
@tomenscape fyi DirectProperties styling never worked properly. It always was an undefined behavior, as you can apply style with these setters, but you cannot remove it. I absolutely agree that we shouldn't release 11.0 with runtime crash for the direct properties, but I believe we should add compile time error with helping information. |
We are using 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. |
Describe the bug
Unhandled exception. System.InvalidOperationException: Cannot set direct property 'IsPaneOpen' in 'SplitView.adaptive' because the style has an activator.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
No exceptions.
Screenshots
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: