Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi every body
can i change the RowDetailsTemplate of my wpf datagrid when selcted row is in edit mode?
i want to change the RowDetailsTemplate of the a row when it is in edit mode.
in general template,the row's detail ,displays data in textblock,i want to switch to textbox ,so it can be edit.
node : i want to do that in xaml.

please help me.
Posted

1 solution

Yes you can. Here's a small example.
Only labels, that you can't edit:
XML
<DataGrid.RowDetailsTemplate>
    <DataTemplate>
        <DockPanel>
            <Label Content="Age: "/>
            <Label Content="{Binding Age}"/>
        </DockPanel>
    </DataTemplate>
</DataGrid.RowDetailsTemplate>

Here the label is replaced with a textbox so that the Age can be edited:
XML
<DataGrid.RowDetailsTemplate>
    <DataTemplate>
        <DockPanel>
            <Label Content="Age: "/>
            <TextBox Text="{Binding Age}"/>
        </DockPanel>
    </DataTemplate>
</DataGrid.RowDetailsTemplate>
 
Share this answer
 
v2
Comments
HOSSEIN.AB 14-Nov-12 3:29am    
ok,thanks for your rep,
but ,how can i do it.
how to set second DataTemplate instead of the first DataTemplate when user pree F2 in Xmal.

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