Skip to content
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

SplitView ":open"/":closed" pseudoclasses aren't set on control initialization #17176

Closed
OccVeneficus opened this issue Oct 1, 2024 · 2 comments · Fixed by #17178
Closed
Labels
bug help-wanted A contribution from the community would be most welcome.

Comments

@OccVeneficus
Copy link
Contributor

Describe the bug

SplitView control after it initialized does not have :open or :closed pseudoclass set. Regardless of the value in the IsPaneOpen property.

To Reproduce

Create Window with a SplitView control, set IsPaneOpen to any value (e.g, by binding to ViewModel)
Run the application in Debug, open Debug tools
In Logical Tree, find SplitView. The SplitView doesn't have :open / :closed pseudoclass set regardless of the value in the IsPaneOpen property.
image

Pseudoclass is set only after first change of IsPaneOpen property

Expected behavior

SplitView control after initialization should have :open / :closed pseudoclass set depending of the value in the IsPaneOpen property

Avalonia version

11.1.0

OS

Windows

Additional context

After looking into SplitView.cs source code, the problem appears to be that the logic for changing pseudoclass based on IsPaneOpen value is present only in OnPropertyChanged method. Adding same logic to constructor should fix the issue

@timunie
Copy link
Contributor

timunie commented Oct 1, 2024

@OccVeneficus if you have an idea how to solve it, a PR is welcome.

@timunie timunie added the help-wanted A contribution from the community would be most welcome. label Oct 1, 2024
OccVeneficus added a commit to OccVeneficus/Avalonia that referenced this issue Oct 1, 2024
OccVeneficus added a commit to OccVeneficus/Avalonia that referenced this issue Oct 1, 2024
@OccVeneficus
Copy link
Contributor Author

@OccVeneficus if you have an idea how to solve it, a PR is welcome.

Created PR with fix. While working on it discovered that issue reproduces only if before added on view tree IsPaneOpen property is set to false, in that case :closed pseudoclass won't be added after control first rendered.

github-merge-queue bot pushed a commit that referenced this issue Oct 2, 2024
…zation #17176 (#17178)

* test(SplitViewTests.cs): added failing test for issue #17176

* fix(SplitView.cs): added pane state pseudo class update in OnApplyTemplate

- fixed #17176

* test(SplitViewTests): added globalclock mock to failing test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug help-wanted A contribution from the community would be most welcome.
Projects
None yet
2 participants