wpf 中datagridcomboxColumn的数据绑定主要分下面几步
1。提供数据源类型:可以是任意的数据类型:这里用枚举
public
enum
OrderStatus
{ None, New, Processing, Shipped, Received };
2。设置静态数据源:
<ObjectDataProvider x:Key="dataProvider
" MethodName="GetValues" ObjectType="{x:Type sys:Enum}">
<ObjectDataProvider.MethodParameters>
<x:Type Type="local:OrderStatus
"></x:Type>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
3。绑定数据源:
SelectedItemBinding="{Binding Status}" ItemsSource="{Binding Source={StaticResource dataProvider
}
}"