I have a simple DataGrid that I want the user to add multiple rows. However, I want one of the columns to be a ComboBox with its values taken from the enumeration .
What is the easiest way to do this in my XAML?
I tried following, but I get the error "Two-way binding requires Path or XPath"
<Window.Resources>
<ObjectDataProvider x:Key="myEnumData"
MethodName="GetValues"
ObjectType="{x:Type sys:Enum}">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="local:MyEnum" />
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
</Window.Resources>
...
<DataGrid.Columns>
<DataGridComboBoxColumn Header="MyHeader" DisplayMemberPath="EnumValue"
SelectedItemBinding="{Binding Source={StaticResource myEnumData}}">
</DataGridComboBoxColumn>
</DataGrid.Columns>
source
share