当我通过 Item Source 添加项目时,如何编辑 Menu Item 图标?

How can I edit the Menu Item icon when I add the item via Item Source?

我有一个 MenuItem,我在这个 MenuItem 中添加了一个 ItemSource,因此这个 menuItem 的项目是从一个 Observable 集合创建的。我的 MenuItem 看起来像这样:

 <MenuItem Foreground="Black" 
                          FontFamily="{Binding ElementName=wpfAudit, Path=FontFamily}"
                          FontSize="{Binding ElementName=wpfAudit, Path=FontSize}" 
                          FontWeight="{Binding ElementName=wpfAudit, Path=FontWeight}" 
                          Header="Artikellabel Drucker" 
                          ItemsSource="{Binding ocArtikellabeldrucker, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}">

                
                </MenuItem>

现在我想编辑我使用 ItemSource 创建的项目的 MenuItem.Icon。

我试过的是这样的:

<MenuItem.Resources>
                        <RadioButton x:Key="RadioButtonResource" x:Shared="false" HorizontalAlignment="Center"
                 GroupName="MenuItemRadio" IsHitTestVisible="False" IsChecked="{Binding IstDrucker}" Style="{StaticResource {x:Type RadioButton}}"/>
                    </MenuItem.Resources>

但这确实有效。那么我怎样才能让它发挥作用呢?也许使用 ControlTemplate ?

像下面这样的东西会起作用

 <Style x:Key="MenuItemStyle" TargetType="{x:Type MenuItem}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type MenuItem}">
                    <StackPanel Orientation="Horizontal">
                        <RadioButton IsChecked="True" Content="Test Item" />
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>