我试图添加一个组合框到Xceed WPF数据网格,但无法将Itemssource绑定到组合框。这是数据网格的xaml。如何绑定xceed datagrid中的组合框的Itemssource
<xwpf:DataGridControl ItemsSource="{Binding SaleDetails}" AutoCreateColumns="False" >
<xwpf:DataGridControl.Columns>
<xwpf:Column FieldName="Status" Title="Status" CellContentTemplate="{StaticResource colReinstatementType}" CellEditor="{StaticResource statusEditor}" />
</xwpf:DataGridControl.Columns>
</xwpf:DataGridControl>
资源
<UserControl.Resources>
<DataTemplate x:Key="colReinstatementType">
<ComboBox BorderThickness="0"
x:Name="cmbStatus1"
IsReadOnly="False"
IsEditable="True"
MinHeight="20"
DisplayMemberPath="part_no"
Text="{xwpf:CellEditorBinding NotifyOnSourceUpdated=True}"
SelectedItem="{Binding Item, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
ItemsSource="{Binding AvailablePartMaterial, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
</ComboBox>
</DataTemplate>
<xwpf:CellEditor x:Key="statusEditor">
<xwpf:CellEditor.EditTemplate>
<DataTemplate>
<ComboBox BorderThickness="0"
x:Name="cmbStatus"
IsReadOnly="False"
IsEditable="True"
MinHeight="20"
DisplayMemberPath="part_no"
Text="{xwpf:CellEditorBinding NotifyOnSourceUpdated=True}"
SelectedItem="{Binding Item, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
ItemsSource="{Binding AvailablePartMaterial, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
</ComboBox>
</DataTemplate>
</xwpf:CellEditor.EditTemplate>
</xwpf:CellEditor>
</UserControl.Resources>
Item
和AvailablePartMaterial
不要在SaleSheet
类型,其集合绑定到DataGrid存在。即使Item
属性确实被解雇,这意味着组合框的选定项目正在绑定。但是没有数据显示在组合框中。
你能检查输出窗口的绑定失败日志吗? – user1672994
thr在输出窗口中没有绑定失败 – WAQ