我有一个产品集合 { SuppliesId, SupplyProductName } 我还有一张连接到此产品列表的发票 ProductInvoice {InvoiceId, SupplyProductId } 我创建了一个带有组合框的 WPF DataGrid,该组合框绑定到用于显示的 {SupplierProductName} 和 {SupplierProductId},这在显示 {SupplierProductId} 时一切正常,但我希望它显示 {SupplierProductName}
<DataGridTemplateColumn Header="Product">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding SupplierProductId}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
<DataGridTemplateColumn.CellEditingTemplate>
<DataTemplate>
<ComboBox ItemsSource="{Binding Path=DataContext.AllSupplierProducts, RelativeSource={RelativeSource AncestorType=UserControl}}"
SelectedValue="{Binding Path=SupplierProductId, Mode=TwoWay}"
DisplayMemberPath="SupplierProductName"
SelectedValuePath="SuppliesId" />
</DataTemplate>
</DataGridTemplateColumn.CellEditingTemplate>
通过 Aksh Digital Solutions 增强您品牌的在线形象,Aksh Digital Solutions 是莫哈利首屈一指的数字营销公司。我们专注于根据您独特的业务需求量身定制创新策略,提供全面的服务来扩大您的在线影响力并推动增长。