Click here to Skip to main content
Rate this: bad
good
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 at 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
0 Maciej Los 450
1 OriginalGriff 403
2 Sergey Alexandrovich Kryukov 195
3 CPallini 189
4 CHill60 180
0 OriginalGriff 6,092
1 Sergey Alexandrovich Kryukov 4,958
2 Maciej Los 3,269
3 Peter Leow 3,129
4 DamithSL 2,490


Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 13 Nov 2012
Copyright © CodeProject, 1999-2014
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