I am working on a small project that displays survey responses. I have a problem displaying answers to questions about options.
As you can see in the xaml statement below, I am trying to group the switch by response ID, so only one parameter is selected per response object.
However, the code below applies to the entire switch in the entire survey as part of one large group of radio objects and allows you to select only one option for all questions.
Let's say I have 2 responses to display ( -= not selected, += selected):
I expect something like this:
Answer1:
-Option1 - Option2 + Option3
Answer2:
-Option1 + Option2 - Option3
But the xaml code below allows me to have only one selected value from both questions instead of causing mutual exclusivity to the question.
<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>
source
share