我正在尝试将组合框添加到 Xceed WPF 数据网格,但无法将 Itemssource 绑定到组合框。这是数据网格的 xaml。
<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
于其集合绑定到数据网格的类型中。甚至Item
属性确实被触发,这意味着组合框的选定项正在被绑定。但是组合框中没有显示任何数据。