nagaraju

nagaraju

  • NA
  • 87
  • 129.7k

Find out the controls in datagrid

Aug 22 2011 1:04 AM
Hi,

i took datagrid in that i placed labels and radiobuttons in datatemplate .
using this i am displaying one question paper. now i want to find out the question no ie <sdk:Label x:Name="lbl_QID" Content="{Binding QID}" Tag="{Binding QID}" /> and the correct answer ie radiobutton. how can i find out the question id and selected radiobutton in datagrid . can u please tell me the solution.here i am sending my source code



<sdk:DataGrid x:Name="Qpdatagrid"  AutoGenerateColumns="False" ItemsSource="{Binding ElementName=dataSource, Path=Data}" SelectionChanged="Qpdatagrid_SelectionChanged">
  <sdk:DataGrid.Columns>
  <sdk:DataGridTemplateColumn>
  <sdk:DataGridTemplateColumn.CellTemplate>
  <DataTemplate>
  <StackPanel >
  <StackPanel Orientation="Horizontal">
  <!--<TextBlock Text="{Binding Path=QID}" />-->
  <sdk:Label x:Name="lbl_QID" Content="{Binding QID}" Tag="{Binding QID}" />
  <TextBlock Text=")"/>
  <TextBlock Text="{Binding Path=Question}" />
  </StackPanel>
  <StackPanel Orientation="Vertical" Height="100">
  <RadioButton x:Name="Option1" GroupName="{Binding group1}" IsChecked="{Binding Questionpaper, Mode=TwoWay}" Content="{Binding Option1}" Checked="OPtion1_Checked"/>
  <RadioButton x:Name="Option2" GroupName="{Binding group1}" Content="{Binding Option2}" IsChecked="{Binding Questionpaper, Mode=TwoWay}"  Checked="Option2_Checked"/>
  <RadioButton x:Name="Option3" GroupName="{Binding group1}" IsChecked="{Binding Questionpaper, Mode=TwoWay}" Content="{Binding Option3}" Checked="Option3_Checked"/>
  <RadioButton x:Name="Option4" GroupName="{Binding group1}" IsChecked="{Binding Questionpaper, Mode=TwoWay}" Content="{Binding Option4}" Checked="Option4_Checked"/>
 
  </StackPanel>
  </StackPanel>
  </DataTemplate>
  </sdk:DataGridTemplateColumn.CellTemplate>
  </sdk:DataGridTemplateColumn>
  </sdk:DataGrid.Columns>

 
 
  </sdk:DataGrid>


Thanks
P.Nagaraju





Answers (5)