I have multiple ratio buttons in itemscontrols and datatemplates binded to database data in a MVVM / prism application. Each group of radio buttons is grouped with a name accordingly so that they are seprate groups.
The problem I'm having (and goes against convention of radio buttons) is that you can select multiple options within the group. Not all options allow multiple selection. Some behave as they should others do not. On inspection through snoop all radio buttons are part of the same group but with multiple buttons reporting true to IsChecked.
Any ideas?
Thanks
EDIT - Code
XAML
<StackPanel Grid.Column="0" Margin="10,0,0,10">
<TextBlock Margin="5,5,0,5"
FontSize="16"
FontWeight="Bold"
Foreground="{Binding Path=ThemeBackground}"
Text="From" />
<ItemsControl ItemsSource="{Binding Path=InternetItems}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<RadioButton Margin="5"
Content="{Binding Path=Title}"
GroupName="InternetFrom"
IsChecked="{Binding Path=IsSelected}"
IsEnabled="{Binding Path=IsEnabled}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
View Model
public ObservableCollection<Item> InternetItems
{
get
{
return
new ObservableCollection<Item>(
_items.Where(x => x.Category == Category.InternetFrom).OrderBy(x => x.DisplayOrder));
}
}
Edit -
Problem resolved. Code behind was initiating a new observable collection each time a radio button was selected leading to multiple datacontexts regardless of the groupnames of the radio buttons being the same