WPF DataGridComboBoxColumn Supported Scenario

Sep 1, 2009 at 1:23 PM

Hello All,

I'm trying to figure out how to acomplish a specific databiding scenario in WPF DataGrid, but I couldn't make it work:

Suppose I have a list of Orders (as a collection of business objects) and they are bound to a WPF DataGrid. On the DataGrid, I must have a DataGridComboBoxColumn bound to the "Status" property of my orders collection. This Status property is member of the Order class, but it is not a regular type. In fact it is an object of type "OrderStatus" wich may have a code, description, and other properties

As you can imagine what I must do is to allow the user to change the status of the order selecting the desired Status on the combo.

When the application loads, I populate the ItemsSource property of the DataGridComboBoxColumn with a collection of all OrderStatus available in my system. This is OK.

My problem is when I show the datagrid with all orders, the comboboxcolumn is empty, besides all available order status are avilable for selection.... I'm almost sure I'm not setting the binding properly, so I would like to have some help from you guys about what properties I'm missing.... Currently my DataGridComboBoxColumns is declared as:

 

<dg:DataGridComboBoxColumn x:Name="orderGrid" Header="{LocText Assembly=OtimizeStandard, Dict=Resources, Key=ORDERS}"
        		SelectedItemBinding="{Binding Status, ValidatesOnExceptions=True}" DisplayMemberPath="Description" Width="*" />
                                    

What other binding properties should I set?

Thanks in Advance,

 

Igor                                   

Coordinator
Sep 1, 2009 at 10:01 PM

Hi ikondrasovas,

If possible, could you please post a reproduction, or at least what your itemssource looks like and where it's getting set?

Thanks!

Sep 2, 2009 at 4:37 AM

Hello brandf.

Thank you for the reply back. Here is my real data

Here is the image that represents my objects: http://www.inovativatec.com/download/codeplex.png

My datagrid will contain a list of PieceRequest objects and one datagridcomboboxcolumn bound to the Materila Property, from the Material Class

The ItensSource property of the combo is filled with all Material objects available on the sytem

What I wnat to do is to allow the user to select the Material, change it "Code" Property

Thanks in advance for any help.

Igor