Q:

Different formatting on context menu items based on data template

I have a working dynamic context-menu but there seems to be an issue with the XAML-formatting. To me, it seems as the first template selected will be used for all the menu items.

I would like to achieve a result where the icons are placed in the normal standard location on the left highlighted column and I could still customize the right-side XAML-content for each menu item separately as defined in their DataTemplate.
Heres the XAML-code snipped, used with ListBox
<ListBox.ContextMenu>
    <ContextMenu ItemsSource="{Binding ModelContextMenu}"
                 ItemTemplateSelector="{StaticResource ContextMenuItemDataTemplateSelector}">
    </ContextMenu>
</ListBox.ContextMenu>

And the data templates for different menu items:
  <DataTemplate x:Key="ChangeColorMenuItem" DataType="MenuItem">
    <DockPanel>
      <MenuItem Header="{Binding DisplayName}"
                Command="{Binding Command}">
      </MenuItem>
      <xctk:ColorPicker
        SelectedColor="{Binding DataContext.SelectedColor, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:View}}}"
        Margin="0,0,0,0" />
    </DockPanel>
  </DataTemplate>

  <DataTemplate x:Key="NormalMenuItem" DataType="MenuItem">
    <MenuItem Header="{Binding DisplayName}"
              Command="{Binding Command}">
      <MenuItem.Icon>
        <Image Source="{Binding Icon}"/>
      </MenuItem.Icon>
    </MenuItem>
  </DataTemplate>

and finally the template selector class:
public class ContextMenuItemDataTemplateSelector : DataTemplateSelector
{
    public override DataTemplate SelectTemplate(object item, DependencyObject container)
    {
        if (container is FrameworkElement element && item is ContextMenuCommand commandItem)
        {
            switch (commandItem.MenuType)
            {
                case ContextMenuType.Normal:
                    return
                        element.FindResource("NormalMenuItem") as DataTemplate;
                case ContextMenuType.ChangeColor:
                    return
                        element.FindResource("ChangeColorMenuItem") as DataTemplate;
                default:
                    throw new ArgumentOutOfRangeException();
            }
        }

        return null;
    }
}

EDIT 1
Each MenuItem content is capsulated in the list which is bind to the ContextMenu. The objects in the collection do contain all the data for each MenuItem, such as icon, display name, and ICommand.
public ObservableCollection<ContextMenuCommand> ModelContextMenu => _selectedModel.Commands;

EDIT 2
The desired (standard) icon location marked with blue crosses on the following image:

A:

The problem seems to be two inner MenuItem because of the data templates in question.
The problem was solved by defining ItemTemplate and a custom ItemContainerStyle in the following way:
DataTemplates
<DataTemplate x:Key="ChangeColorMenuItem" DataType="MenuItem">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <TextBlock Grid.Column="0"
            Text="{Binding DisplayName}"
            Padding="5,0,5,0"/>
        <xctk:ColorPicker Grid.Column="1"
            SelectedColor="{Binding DataContext.SelectedEntityColor, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:PanelView}}}"
            Margin="0,0,0,0" />
    </Grid>
</DataTemplate>

<DataTemplate x:Key="NormalMenuItem" DataType="MenuItem">
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>
        <TextBlock Grid.Column="0"
            Text="{Binding DisplayName}" />
    </Grid>
</DataTemplate>

ListBox ContextMenu
<ListBox.ContextMenu>
    <ContextMenu ItemsSource="{Binding CadModelContextMenu}"
        ItemTemplateSelector="{StaticResource PanelContextMenuItemDataTemplateSelector}"
        UsesItemContainerTemplate="True">
        <ContextMenu.Resources>
            <ResourceDictionary>
                <Image x:Key="menuIcon" x:Shared="false"
                    Source="{Binding Path=Icon}" Height="16px" Width="16px"/>
            </ResourceDictionary>
        </ContextMenu.Resources>
        <ContextMenu.ItemContainerStyle>
            <Style TargetType="{x:Type MenuItem}">
                <Setter Property="Icon" Value="{StaticResource menuIcon}"/>
                <Setter Property="Command" Value="{Binding Command}"/>
            </Style>
        </ContextMenu.ItemContainerStyle>
    </ContextMenu>
</ListBox.ContextMenu>

The icon with this solution is different for each item. The icon is defined in the property of the underlaying object.

