MaterialDesignInXAML / MaterialDesignInXAML/MaterialDesignInXamlToolkit

Binding issues with ContextMenu and CompositeCollection

Open
#3,464 17 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
16.3k
Forks
3.5k
Avg merge
1d 22h
Merged PRs (30d)
8

Description

### Bug explanation

I have XAML Binding Failures with MenusAndToolBars.xaml if I change the lines https://github.com/MaterialDesignInXAML/MaterialDesignInXamlToolkit/blob/master/MainDemo.Wpf/MenusAndToolBars.xaml#L355-L360 with the follwogin content:

```xaml








```

saying:

> Severity Count Data Context Binding Path Target Target Type Description File Line Project
Error 2 null (0) MenuItem.Height Double Cannot find source: RelativeSource FindAncestor, AncestorType='System.Windows.Controls.Primitives.MenuBase', AncestorLevel='1'.

Do you have an idea how to fix this issue?

### Version

4.9.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in MainDemo.Wpf/MenusAndToolBars.xaml at lines 355-360 and reproduce the two binding failures using the supplied ContextMenu and CompositeCollection markup. Inspect how MenuItem.Height resolves its MenuBase ancestor in this configuration. Done means the example no longer reports the Cannot find source binding errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.