DataGrid binding to different enums in column

Nov 18, 2009 at 8:51 PM

Is it possible to bind different enums to one DataGridComboBoxColumn?

I need to display a couple of physical properties like temperatur, pressure, weight in a datagird. All these physical properties have a name, a physical unit and a value.

 

Public Class physicalProperty

  Public Property name() As [Enum]
    Get
        ....
    End Get
    Set(ByVal value As [Enum])
        ...
  End Property


  Public Property unit() As [Enum]
    Get
        ....
    End Get
    Set(ByVal value As [Enum])
        ...
  End Property


  Public Property value() As double
    Get
        ....
    End Get
    Set(ByVal value As double)
        ...
  End Property

End Class


Each row of my datagird should show one physical property. The first column displays the name, the second the unit and 
the third the value of the phy. property.
I would like to be able to change the unit in the datagrid with the help of a combobox.
All solutions I found for binding a enum to a datagridComboboxColumn used a ObjectDataProvider to set the itemssource for the datagridCombobox:

<ObjectDataProvider MethodName="GetValues"
                        ObjectType="{x:Type sys:Enum}"
                        x:Key="AlignmentValues">
      <ObjectDataProvider.MethodParameters>
        <x:Type TypeName="namespace:myEnum" />
      </ObjectDataProvider.MethodParameters>
</ObjectDataProvider>

But I don't have one enum. I have for each physical property a enum ( temperature (K, C, F), pressure (bar, Pa), weight (kg, g)).

Maybee I can use one enum for all physical units and dispaly only the valid ones by filtering?

Is there a way to meet my requirements?
reibor