Click here to Skip to main content
12,356,774 members (63,661 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: WPF
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 10-Nov-12 22:52pm

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Yes you can. Here's a small example.
Only labels, that you can't edit:
<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:
<DataGrid.RowDetailsTemplate>
    <DataTemplate>
        <DockPanel>
            <Label Content="Age: "/>
            <TextBox Text="{Binding Age}"/>
        </DockPanel>
    </DataTemplate>
</DataGrid.RowDetailsTemplate>
  Permalink  
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160621.1 | Last Updated 13 Nov 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100