Datagrid / default combo boxes

Aug 17, 2009 at 1:20 AM
Edited Aug 17, 2009 at 1:22 AM

I am giving the datagrid in the toolkit a try.  If I auto generate the columns, I have success in viewing and editing the underlying observable collection.

One of the columns of the collection is an enum and the resulting combobox that appears works perfectly.

When I display the contents of the collection, I show all columns, and they are read-only.  This works fine as well, of course.


In an editing mode for the application, I need to select which columns are viewed in an editing window, and therefore, believe it is not possible for me to 'auto generate' the columns, but must code each in XAML.

So I coded the several columns for the editing window in XAML, and the text fields are fine, but I am unable to determine how to correctly bind the combobox pull down list to the enum.  I am fairly new to WPF as well, obviously.

So, essentially, I'm asking:  How does one code up a combobox to an enum in a default manner, like the autogenerate function would?

Secondly, I have a 'description' attribute associated with each element of the enum, from system.componentmodel.  How might I use the long description in the combobox?


Aug 17, 2009 at 10:31 AM

You can use the AutoGeneratingColumn event to override any properties on the auto-generated columns, or (likely - I don't have first-hand experience with this) prevent them from being included in the columns collection at all.