简体   繁体   中英

ComboBox in a DataGrid Cell in WPF MVVM

I am working on a WPF MVVM Project.

Now i have a DataGrid in which i want this.

When ever the user comes to the FirstColumn of the DataGrid the Cell should be transformed into ComboBox and when user goes out of that cell the ComboBox should disappear and ComboBox selected value to the CellText.

How can i do that.

Only the selected Cell in the first column should have ComboBox

You will find this much easier if you use a DataGrid rather than a GridView . The DataGrid has the concept of CellTemplates and CellEditingTemplates built in, which make it very easy to render an edit control whilst the user is editing the cell.

Oh yes, and it has a combo-box column type, DataGridComboBoxColumn .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM