項目コントロールにあるラジオ ボタンにイベントをリンクしようとしています。
私のテンプレートは以下です:
<ItemsControl x:Name="RadioButtonsItemsControl" Height="auto" Width="auto" ItemsSource="{TemplateBinding MapLayers}" >
                        <ItemsControl.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel Orientation="{TemplateBinding RadioButtonOrientation}" Margin="5"/>
                            </ItemsPanelTemplate>
                        </ItemsControl.ItemsPanel>
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <RadioButton Content="{Binding ID}" IsChecked="{Binding Visible, Mode=TwoWay}"
                                    IsEnabled = "{Binding IsInScaleRange}"
                                    ToolTipService.ToolTip=""
                                    GroupName="BaseLayer"
                                    Foreground="{TemplateBinding ForeGroundBrush}" FontSize="11">
                                </RadioButton>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
カスタム コントロールの .cs ファイルには、アイテム コントロールのテンプレート パーツがあり、イベントを添付します。
public override void OnApplyTemplate()
    {
        base.OnApplyTemplate();
        radioButtonsItemsControl = GetTemplateChild("RadioButtonsItemsControl") as ItemsControl;
        if (radioButtonsItemsControl != null) radioButtonsItemsControl.MouseLeftButtonDown += radioButtonsItemsControlMouseLeftButtonDown;
    }
radioButtonsItemsControl は null ではありません (この段階ではまだラジオ ボタンが設定されていません) が、radioButtonsItemsControlMouseLeftButtonDown イベントは、後で項目コントロール内をクリックしたときに登録する必要があります。
 void radioButtonsItemsControlMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
    {
        RadioButton radioButton = e.OriginalSource as RadioButton;
        if (radioButton != null) radioButton.Checked += OnChecked;
    }
ただし、アイテムコントロールをクリックしても、これは決して発生しません:radioButtonsItemsControlMouseLeftButtonDown。
これが正しい方法であるかどうかわからないので、ItemsControls 内のアイテムにイベントをアタッチする別の方法を受け入れます。
ありがとう、マイク