Silverlight 项目控制显示中的单选按钮

Silverlight 项目控制显示中的单选按钮,silverlight,xaml,Silverlight,Xaml,我需要单选按钮是水平的而不是垂直的,有人能帮我做一下下面的控制吗 <ItemsControl Name="rbQuestionAnswer" ItemsSource="{Binding Answers, Mode=TwoWay}" IsEnabled="{Binding IsEnabled, Mode=OneWay}" > <ItemsControl.ItemTemplate > <DataTemplate >

我需要单选按钮是水平的而不是垂直的,有人能帮我做一下下面的控制吗

<ItemsControl Name="rbQuestionAnswer" ItemsSource="{Binding Answers, Mode=TwoWay}"    IsEnabled="{Binding IsEnabled, Mode=OneWay}"  >
    <ItemsControl.ItemTemplate >
        <DataTemplate >
            <RadioButton GroupName="{Binding SurveyLineID}"
                                 Content="{Binding Answer}" 
                                 Tag="{Binding AnswerId}"               
                                 Style="{StaticResource RadioButtonStyle}"
                                 IsChecked="{Binding IsSelected, Mode=OneWay}"            
                                 Checked="RadioButton_Checked"
                                 Visibility="{Binding Path=IsRadio,Converter={StaticResource BoolConverter}}" >
            </RadioButton>
        </DataTemplate>
    </ItemsControl.ItemTemplate>
</ItemsControl>

我想你可以用
来做这件事。请尝试以下代码

<ItemsControl ItemsSource="{Binding Options}">
            <ItemsPanelTemplate>
                <StackPanel Orientation="Horizontal" />
            </ItemsPanelTemplate>
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <RadioButton GroupName="{Binding AnswerId}" Content="{Binding Option}" IsChecked="{Binding IsSelected, Mode=OneWay}"/>
                </DataTemplate>
            </ItemsControl.ItemTemplate>
</ItemsControl>



修改此代码以满足您的要求。希望它能帮助你

需要在Items控件中添加以下内容:

<ItemsControl.ItemsPanel>
      <ItemsPanelTemplate>
        <StackPanel Orientation="Horizontal"/>
       </ItemsPanelTemplate>
 </ItemsControl.ItemsPanel>

尝试了此操作,但布局仍然相同