WPF ListView-编辑单元格信息 [英] WPF ListView - editting cell information

查看:720
本文介绍了WPF ListView-编辑单元格信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在WPF列表视图的一列中是否可以具有不同类型的编辑框?

我正在创建一个用于编辑参数的列表视图,其中一些是数字的,可以在TextBox中进行修改,其他是二进制的,并且要在ComboBox中进行修改.
我已经成功创建了TextBox和ComboBox,但是没有看到任何有助于在同一列中使用不同编辑类型的地方.

是否可以在XAML或C#中根据需要配置依赖于单元格的DataType的编辑控件?

TIA

Tony

Hi,

Is it possible, within a column on a WPF Listview, to have different types of edit box?

I am creating a list view that edits parameters, some are numerical and can be modified in a TextBox, others are binary and are to be modified in a ComboBox.
I have managed to create the TextBox and the ComboBox, but just have not seen anywhere that helps in having different edit types in the same column.

Is there a way, either in the XAML, or in C# to configure the edit control, as required, dependant on the DataType of my cell?

TIA

Tony

推荐答案

是的,
您可以使用 DataTemplateSelecter [
Yes,
You can use DataTemplateSelecter[^]

Using DataTemplateSelector, you can specify different data template based on data.
Thus for the list, you can specify Combobox, and for the text items you can specify TextBox.
Only consideration is that all these (list, text items) should be part of a Collection to which ListView is bound.


这篇关于WPF ListView-编辑单元格信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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