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

Make data templates work again with MenuItem. #10836

Merged
merged 2 commits into from
Mar 30, 2023

Conversation

grokys
Copy link
Member

@grokys grokys commented Mar 29, 2023

What does the pull request do?

Menus stopped working correctly with data templates after #9677, a few fixes were needed to make them work again:

  • MenuItem is a HeaderedSelectingItemsControl not a HeaderedItemsControl so need to separate logic for that case when preparing items
  • Added HeaderTemplate to HeaderedSelectingItemsControl
  • Tweaked logic for selecting header templates: parent's ItemTemplate should be used if set (cross-checked with WPF)
  • Update menu templates to bind to menu item's HeaderTemplate

Fixed issues

Fixes #10626
Fixes #10718

grokys added 2 commits March 29, 2023 15:35
- `MenuItem` is a `HeaderedSelectingItemsControl` not a `HeaderedItemsControl` so  need to separate logic for that case when preparing items
- Added `HeaderTemplate` to `HeaderedSelectingItemsControl `
- Tweaked logic for selecting header templates: parent's `ItemTemplate` should be used if set (cross-checked with WPF)
- Update menu templates to bind to menu item's `HeaderTemplate`

Fixes #10626
Fixes #10718
@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0032506-beta. (feed url: https://pkgs.dev.azure.com/AvaloniaUI/AvaloniaUI/_packaging/avalonia-all/nuget/v3/index.json) [PRBUILDID]

@maxkatz6 maxkatz6 enabled auto-merge March 29, 2023 15:21
@maxkatz6 maxkatz6 added this pull request to the merge queue Mar 29, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 29, 2023
@rabbitism
Copy link
Contributor

I think this solves my question in #10195

@maxkatz6 maxkatz6 added this pull request to the merge queue Mar 30, 2023
Merged via the queue into master with commit 660033c Mar 30, 2023
@maxkatz6 maxkatz6 deleted the fixes/10626-menuitem-headertemplate branch March 30, 2023 12:06
@grokys grokys mentioned this pull request Apr 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants