Saturday, December 8, 2012

How to use foreach DataGridRow of datagrid

How to use foreach DataGridRow of datagrid

I have this datagrid

<ComboBox Name="cbMappingQuestions" SelectedValuePath="MapQuestionId"  SelectedValue="{Binding MapQuestionId,Mode=TwoWay}"  SelectionChanged="cbMappingQuestions_SelectionChanged" FontSize="13" FontFamily="Tahoma"  DisplayMemberPath="MapQuestionText" Width="300" Margin="20,15,30,30" Height="30" HorizontalAlignment="Left"/>         <StackPanel>             <dataGrid:DataGrid x:Name="dgmappingOptions" Padding="0"  Width="740"  Margin="0,0,0,5" AutoGenerateColumns="False"   IsReadOnly="True">                 <dataGrid:DataGrid.Columns>                     <dataGrid:DataGridTextColumn Binding="{Binding OptionText}" Width="470" Header="Option" />                     <dataGrid:DataGridTemplateColumn CanUserReorder="False"   CanUserResize="False" Header="">                         <dataGrid:DataGridTemplateColumn.CellTemplate>                             <DataTemplate>                                 <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">                                     <ComboBox Name="cbOptions" SelectedValuePath="MapOptionId" FontSize="13" FontFamily="Tahoma"  DisplayMemberPath="MapOptionText" SelectedValue="{Binding MapOptionId,Mode=TwoWay}" Width="250" Margin="5" Height="25" HorizontalAlignment="Left"/>                                 </StackPanel>                             </DataTemplate>                         </dataGrid:DataGridTemplateColumn.CellTemplate>                     </dataGrid:DataGridTemplateColumn>                 </dataGrid:DataGrid.Columns>             </dataGrid:DataGrid>         </StackPanel>     </StackPanel> 

In the selectchanged event of the cbMappingQuestions i want to assign List for every cbOptions combobox in the data grid.

so I want to read every row so that i can compare with option text and do some extra stuff. How do we do that in silverlight.

Thanks for any help.

Answers & Comments...

Answer: 1

http://live.mscommunity.net/blogs/damirdobric/archive/2010/05/02/accessing-of-rows-in-silverlight-datagrid.aspx

"This very important and very frequent requirement is just an issue. You will notice that this is almost impossible and will start to research in internet. "

by : iamtonyzhouhttp://stackoverflow.com/users/1027127




No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog