更改wpf datagrid的RowDetailsTemplate吗? [英] change the RowDetailsTemplate of wpf datagrid?

查看:212
本文介绍了更改wpf datagrid的RowDetailsTemplate吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
选择的行处于编辑模式时,我可以更改wpf数据网格的RowDetailsTemplate吗?
我想在编辑模式下更改行的RowDetailsTemplate.
在一般模板中,该行的详细信息,以文本块显示数据,我想切换到文本框,以便可以对其进行编辑.
节点:我想在xaml中做到这一点.

请帮助我.

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.

推荐答案

是的.这是一个小例子.
仅标签,您不能
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>


这篇关于更改wpf datagrid的RowDetailsTemplate吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆