ComboBox In DataGrid In WPF

Download Source


This article will describe the DataGrid in Edit mode while the edit cell requires a list of data. We are going to achieve that using the ComboBox.

Crating WPF Application Project

Fire up Visual Studio 2008 and Create a WPF Application and name the project as DatePickerDGWPF.

Here is the basic idea of our sample application; we would have sample data with one property that can be selected from a list of values displayed in ComboBox.

When the particular cell will be edit mode, we would be able to select from the list displayed in the ComboBox.

So let’s have a class and have sample data.

Now we will add a DataGrid to the Window and design the Columns inside of it.

We need to set the ItemSource Property; for that I have created a Class that would generate the list and in XAML I have accessed it and assigned it. The following figures will clarify what I have done:

It seems we are done with the design of our DataGrid columns.

Run the application and try to edit the column “Status”, you would get ComboBox control to handle the Status List.

And when in Edit mode:

After Updating:


Hope this article helps. J

Related Posts:

1) Making Timeline Control for DataGrid In WPF

2) Custom Gridline Color of Datagrid In WPF

3) Custom Row and Header Height of Datagrid In WPF

4) Rounded Corner Datagrid In WPF

5) Tooltip In DataGrid In WPF

6) Grouping In Datagrid In WPF

7) Cell Alignment In DataGrid In WPF

8) Edit Row Details In Context Menu In DataGrid In WPF

9) Hide/Un-Hide Columns Using Context Menu In DataGrid In WPF

10) Hide &Un-Hide DataGrid Column(s) In WPF

11) DatePicker In DataGrid In WPF

12) CRUD Operation In DataGrid In WPF