Want to merge data from two different Grids
I am working on a silverlight application and am creating girds dynamically with each having one row and two columns. In the fi开发者_开发技巧rst grid I am populating column with some fields(text box/ combobox/ datepicker etc) and leaving column 2 blank. In the second grid I am populating the second column and leaving the first blank and so on alternately. Now I want the data from the second column in the second grid in the first grid. (In a way I want to merge two grids). Is there any way to do that?
It goes something like this:
<Grid>
<views:DynamicFieldsView IsTabStop="True" Grid.Column="0" DataContext="{Binding Path=FieldProperties}" />
</Grid>
And the dynamicFieldsView is like this:
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="{Binding GridColumnNumber}" width = 140 ....>
<Controls:FieldItemControl FieldType="{Binding Type}" Margin="10,0,0,0" Grid.Column="{Binding FieldGridColumnNumber}">
<Controls:FieldItemControl.DataTemplates>
<Controls:TemplateSelectorDataTemplate FieldType="TextBox">
<TextBox Text="{Binding UserText}" width = 200 ....>
</Controls:TemplateSelectorDataTemplate>
<Controls:TemplateSelectorDataTemplate FieldType="Button">
<Button x:Name="SearchButton" Margin="10 10 10 0" .....>
</Controls:TemplateSelectorDataTemplate>
<Controls:TemplateSelectorDataTemplate FieldType="DropDownList">
<DynamicControls:AutoCompleteComboBox VerticalAlignment="Top" Width =200 ....>
</Controls:TemplateSelectorDataTemplate>
....
....
....
</Controls:FieldItemControl.DataTemplates>
</Controls:FieldItemControl>
</Grid>
You should clone the control from the second grid into the first and make a binding so both display same data.
精彩评论