WPFでは、ラジオボタンをこのようなViewModelのプロパティにバインドしようとしています。SO回答https://stackoverflow.com/a/2285732
ボタンが垂直に積み重ねられていることを除いて、すべてが正常に機能します。さて、これは簡単な修正のようです。ItemsPanelTemplateを変更するだけです。
これが私のコードです:
<ListBox ItemsSource="{Binding ItemOptions}" SelectedItem="{Binding SelectedOption}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" IsItemsHost="True" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemContainerStyle>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}" >
<RadioButton Content="{TemplateBinding Content}"
IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=IsSelected}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
ただし、アイテムは垂直に積み重ねられたままです。これがリストボックスの向きに影響を与えない理由はありますか?