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

CheckBox in MenuItem.Icon doesn't display correctly #367

Closed
IsaacMarovitz opened this issue May 16, 2023 · 6 comments
Closed

CheckBox in MenuItem.Icon doesn't display correctly #367

IsaacMarovitz opened this issue May 16, 2023 · 6 comments
Labels
bug Something isn't working

Comments

@IsaacMarovitz
Copy link
Contributor

IsaacMarovitz commented May 16, 2023

Describe the bug
If you use a CheckBox in a MenuItem.Icon, the resulting CheckBox will be too small and off-center.

<MenuItem
    Command="{Binding ToggleStartGamesInFullscreen}"
    Header="{locale:Locale MenuBarOptionsStartGamesInFullscreen}">
    <MenuItem.Icon>
        <CheckBox MinWidth="{DynamicResource CheckBoxSize}"
                  MinHeight="{DynamicResource CheckBoxSize}"
                  IsChecked="{Binding StartGamesInFullscreen, Mode=TwoWay}"/>
    </MenuItem.Icon>
</MenuItem>

MinWidth and MinHeight do not seem to have the desired changes; excluding them or changing their value doesn't solve the problem. Worked in Ava 10.

Screenshots:
Screenshot 2023-05-16 at 11 57 17

Icon CheckBox shown in top-left, expected CheckBox size shown in bottom right.

Desktop/Platform:

  • OS: Windows 11/macOS
  • FluentAvalonia Version: 2.0.0-preview8
  • Avalonia Version: 11.0.0-preview8
@IsaacMarovitz IsaacMarovitz added the bug Something isn't working label May 16, 2023
@amwx
Copy link
Owner

amwx commented May 24, 2023

It looks like the padding around the ContentPresenter for CheckBox is reserving space to the right of the check area which is messing with the scaling in the Viewbox of MenuItem's template (the Viewbox is why you can't change the size yourself). Probably best to use a special styling class to just hide the ContentPresenter in CheckBoxes used within MenuItem.

Closing as by-design.

@amwx amwx closed this as not planned Won't fix, can't repro, duplicate, stale May 24, 2023
@IsaacMarovitz
Copy link
Contributor Author

Closing as by-design.

Disabling the ContentPresenter doesn't seem to make any significant difference. I checked and the ones that are being displayed correctly are just part of the HeaderPresenter ie not the IconPresenter at all.

@IsaacMarovitz
Copy link
Contributor Author

Screenshot 2023-05-29 at 09 58 51

Just setting the content to be the checkbox does fix it, but it looks really messy alongside the other items

@IsaacMarovitz
Copy link
Contributor Author

Another slightly unrelated issue, but the shortcut in the screenshot F11 is getting pushed to the side by a Chevron icon, even though that menu item has no children.

@amwx
Copy link
Owner

amwx commented May 29, 2023

You might be better off waiting until AvaloniaUI/Avalonia#11441 is ready which won't require a checkbox for toggle menu items.

Another slightly unrelated issue, but the shortcut in the screenshot F11 is getting pushed to the side by a Chevron icon, even though that menu item has no children.

This is probably because WPF menus (which Avalonia mimics) uses Grid.SharedSizeScope for menu items and the InputGesture text and the chevron are two different grid columns. This too, is by design.

@Alexbeerses
Copy link

CheckBox in menuItem icon is stiil clipped in Avalonia 11.2.2.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants