WPF DataGrid的一列中的不同编辑控件 [英] Diferent Editing Controls in one column in WPF DataGrid

查看:78
本文介绍了WPF DataGrid的一列中的不同编辑控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个如下的数据表. Items和DataType是两列.

物品|数据类型|值
-----------------------------------
A I 5
B S测试
C S WPF网格
D B true
E I 2451
F B错误


我想将DataTable绑定到WPF DataGrid.我想对基于数据类型列"的值"列进行不同的编辑控制.

如果我编辑第一行和第二行,则必须是文本列,就像我编辑4&第6行...必须是带有true/false的combobox列,是combobox的项...

任何建议,不胜感激...

谢谢与问候
PMM:)

Hi All,

I have a datatable like follows. Items and DataType are two columns.

Items| DataType | Value
-----------------------------------
A I 5
B S Test
C S WPF Grid
D B true
E I 2451
F B false


I want to bind the DataTable to a WPF DataGrid. I want to have different editing controls on a Value column based on the DataType Column.

If I edit first and second row row, it has to be the text column, where as If I edit 4 & 6 row ... it has to be the combobox column with true/false are the items of the combobox...

Any suggestions much appreciated...

Thanks and Regards
PMM :)

推荐答案

您需要在CellEditorTemplate中使用DataTriggers
You need to use DataTriggers in CellEditorTemplate


这篇关于WPF DataGrid的一列中的不同编辑控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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