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

TreeViewItem with no items shouldn't show the toggle button #90

Open
MikePelton opened this issue Jan 6, 2023 · 0 comments
Open

TreeViewItem with no items shouldn't show the toggle button #90

MikePelton opened this issue Jan 6, 2023 · 0 comments

Comments

@MikePelton
Copy link

In Controls.TreeView.axaml lines 157-159 are commented out:

  <!--<Style Selector="TreeViewItem[HasItems=false] /template/ Controls|MetroToggleButton#Expander">
    <Setter  Property="IsVisible" Value="false" />
  </Style>-->

In the original design they switch the "expand" toggle off when the item has no sub-items, which is the expected behaviour. The good news is the Avalonia "ItemsControl" that TreeViewItem inherits from gives us an "empty" pseudoclass, so replacing those lines thus:

<Style Selector="TreeViewItem:empty /template/ Controls|MetroToggleButton#Expander">
    <Setter  Property="IsVisible" Value="false" />
  </Style>

...restores the behaviour. I think I'd also argue that the toggle should have the active foregound colour, so line 32:

                  Fill="{TemplateBinding Background}"

... should actually be:

                  Fill="{TemplateBinding Foreground}"

...but that's based on my perceived ease of use rather than the specifics of the design language.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant