I have a datagrid and each row is having a set of radio buttons in 1 column. I have binded these radio buttons using a listbox datatemplate to generate Radiobuttons on the fly.
Here is the code for template:
<data:DataGrid x:Name="formTemplate" AutoGenerateColumns="False" GridLinesVisibility="All" HeadersVisibility="All" ItemsSource="{Binding Path=FormFieldInformation,Mode=TwoWay}" >
<data:DataGrid.Columns>
<data:DataGridTemplateColumn DisplayIndex="1">
<data:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<StackPanel>
<RadioButton GroupName="GN1" Content="From" Width="50"
HorizontalAlignment="Left" VerticalAlignment="Center"/>
</StackPanel>
</DataTemplate>
</data:DataGridTemplateColumn.CellTemplate>
</data:DataGridTemplateColumn>
<data:DataGrid.Columns>
</data:DataGrid>
But there are two problems here: 1. I can only select one single radio button among all the radio buttons generated for the whole datagrid. I want to select one radio button per row. 2. How do i get the selected radiobuttons value in ViewModel?
Any suggestions are appreciated in advance.
Thanks.