0
votes

I have a MenuItem whose ItemsSource is set to the following CompositeCollection:

<CompositeCollection>
    <MenuItem x:Name="SpinnerMenuItem" Header="Waiting..."/>
    <CollectionContainer 
        Collection="{Binding DataContext.Source, 
                     Source={x:Reference SpinnerMenuItem}, 
                     Converter={StaticResource NoOpConverter}}"/>
</CompositeCollection>

The breakpoint inside my NoOpConverter is telling me that my collection is successfully getting bound to the CollectionContainer. The problem is, the menu is showing up completely empty! All I get is a popup about 3 pixels high and 10 pixels wide.

Why are my menu items not being displayed? Even the "SpinnerMenuItem" disappears once the bound list is populated. I was not having this issue in the simpler case, when I was just binding to a CollectionViewSource static resource.

1

1 Answers

0
votes

This appears to be an issue with CompositeCollection. The workaround is to use a StaticResource instead of a Binding or similar. More info here: Why is CompositeCollection not Freezable?