Click here to Skip to main content
15,886,806 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted

1 solution

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.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900