Note that there are some explanatory texts on larger screens.

plurals
  1. POContext sub menu with items source and additional items
    primarykey
    data
    text
    <p>I have a context menu in wpf. One of the items in the menu has a sub menu that gets populated from the ItemsSource of the header menu item. This sub menu is a list of commands that can be sent to another portion of the app. The list is basically a mru list restricted to 10 items. I want to add a separator and then a "More" option below the list of 10 items so the user can see the entire list of available commands. I can't seem to figure out how to add these extra items. I can get the list to populate dynamically from the ItemsSource of the parent menu item but I can't seem to figure out how to add the additional items to the bottom of the child menu. I don't want to put them in the items source and the "More" item needs to have its own command.</p> <pre><code>&lt;MenuItem x:Name="ExecuteCommandMenuItem" Height="22" Style="{StaticResource RightClickMenuItemStyle}" ItemsSource="{Binding Path=PanelCommands}"&gt; &lt;MenuItem.Header&gt; &lt;StackPanel Orientation="Horizontal"&gt; &lt;TextBlock Text="Panel Command" HorizontalAlignment="Left" Width="100"/&gt; &lt;/StackPanel&gt; &lt;/MenuItem.Header&gt; &lt;MenuItem.ItemContainerStyle&gt; &lt;Style TargetType="MenuItem" BasedOn="{StaticResource RightClickMenuItemStyle}"&gt; &lt;Setter Property="MenuItem.Header" Value="{Binding}" /&gt; &lt;Setter Property="MenuItem.Command" Value="CommonCommands:CommandRepository.ExecutePanelCommand" /&gt; &lt;Setter Property="MenuItem.CommandParameter"&gt; &lt;Setter.Value&gt; &lt;MultiBinding Converter="{CommonConverter:PanelCommandArgsConverter}"&gt; &lt;MultiBinding.Bindings&gt; &lt;Binding Path="DataContext" RelativeSource="{RelativeSource FindAncestor, AncestorType={x:Type ContextMenu}}"/&gt; &lt;Binding Path="Command" /&gt; &lt;/MultiBinding.Bindings&gt; &lt;/MultiBinding&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; &lt;/MenuItem.ItemContainerStyle&gt; &lt;/MenuItem&gt; </code></pre> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload