Click here to Skip to main content
15,886,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying the datagrid which same as asp.net grid. i wanna chnage controls in edit click event.

So I wanna edit only particular row.I need to change only particular row controls not total grid.


As of now what I tried is


XML
<data:DataGridTemplateColumn Header="ACTIONS" SortMemberPath="" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
                                  <data:DataGridTemplateColumn.CellTemplate>
                                      <DataTemplate>
                                          <StackPanel>
                                              <Button x:Name="btnCancel" Content="Cancel" Click="btnCancel_Click1" Background="White" Foreground="Black"  BorderThickness="1"></Button>
                                              <Button x:Name="btnUpdate" Content="Edit" Click="btnUpdate_Click" Background="White" Foreground="Black"  BorderThickness="1"  CommandParameter="{Binding Path=Row.DataItem}"> </Button>

                                          </StackPanel>
                                      </DataTemplate>
                                       </data:DataGridTemplateColumn.CellTemplate>
                                       </data:DataGridTemplateColumn>
                              <data:DataGridTextColumn Binding="{Binding DESCRIPTION}" Header="Description" IsReadOnly="True"></data:DataGridTextColumn>

                              <data:DataGridTemplateColumn Header="Components" Width="Auto"  >
                                  <data:DataGridTemplateColumn.CellTemplate>
                                      <DataTemplate>
                                          <StackPanel Orientation="Horizontal" Margin="5,8" HorizontalAlignment="Center">
                                              <TextBlock x:Name="GooseComponent"  VerticalAlignment="Center" Text="{Binding COMPONENTS}"/>

                                          </StackPanel>
                                      </DataTemplate>
                                  </data:DataGridTemplateColumn.CellTemplate>
                              </data:DataGridTemplateColumn>
                              <data:DataGridTemplateColumn Header="Components" Width="Auto" Visibility="Collapsed">
                                  <data:DataGridTemplateColumn.CellTemplate>
                                      <DataTemplate>
                                          <StackPanel Orientation="Horizontal" Margin="5,8" HorizontalAlignment="Center">
                                              <local1:GooseMultiCombobox x:Name="GooseEditComponent" FontSize="13"/>
                                          </StackPanel>
                                      </DataTemplate>
                                  </data:DataGridTemplateColumn.CellTemplate>
                              </data:DataGridTemplateColumn>




here when i click the update button the total datagrid changing the textbox column to combobox.

I dont need that i wanna change only particular row controls when i click the button.remaining as usaual. i dont find any row properties atleast for this datagrid.


So any help plz....
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900