You could try to refer to the sample code below according to your needs. And remember to loop through the complete collection, I'm not looping through the collection here.
iterate
Xaml:
<Window.DataContext>
<local:ViewModel/>
</Window.DataContext>
<StackPanel>
<CheckBox x:Name="cb" IsChecked="{Binding IsAdmin}" Content="IsAdmin" Width="100" Height="50"/>
<Menu DockPanel.Dock="Top" ItemsSource="{Binding MenuItemsView}">
<Menu.ItemContainerStyle>
<Style TargetType="{x:Type MenuItem}">
<Setter Property="Command" Value="{Binding Command}" />
</Style>
</Menu.ItemContainerStyle>
<Menu.ItemTemplate>
<HierarchicalDataTemplate DataType="{x:Type local:MenuItemViewModel}" ItemsSource="{Binding Path=MenuItems}">
<TextBlock Text="{Binding Header}"/>
</HierarchicalDataTemplate>
</Menu.ItemTemplate>
</Menu>
</StackPanel>
Codebedhind:
265114-menuitem-user-icollectionview-filter.txt
The result:
----------------------------------------------------------------------------
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.