Skip to content

Setting Background Property doesnt cover all space for MenuItem in ContextMenu #18170

Answered by maxkatz6
SwiftExtender asked this question in Q&A
Discussion options

You must be logged in to vote

Something closer to this:

  1. You should specify BasedOn, otherwise theme won't inherit default styles (unless you want to completely restyle them).
  2. By setting ItemContainerTheme on ContextMenu directly, it will be applied on all children. Alternatively, if you have a single MenuItem with subgroup - you can assign it there.
  3. You likely want to move CommandParameter to the theme too. But I don't know where "editor" comes from. It might be better done in another way depending on the context.
  4. ContextMenu.ItemTemplate for this simpler scenario can be replaced with ContextMenu DisplayMemberBinding="{Binding Header}" , unless you want to specify more text block properties.
<ContextMenu ItemsSource="

Replies: 6 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by SwiftExtender
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #18071 on February 11, 2025 05:22.