【发布时间】:2020-06-17 07:56:39
【问题描述】:
我正在尝试将名为“MaterialList”的 ObservableCollection 绑定到放置在列中的 Combobox。 C#
public class Delivery
{
//Some other Properties which work
...
public ObservableCollection<string> MaterialList { get; set; }
public ObservableCollection<OpenPosition> OpenPositions { get; set; }
public Delivery()
{
this.MaterialList = new ObservableCollection<string>();
this.OpenPositions = new ObservableCollection<OpenPosition>();
}
}
我检查了该列表中是否有数据,并且有! XAML:
<dxg:GridControl x:Name="grid4" MaxHeight="2000" AutoGenerateColumns="None" ItemsSource="{Binding SelectedDelivery.OpenPositions}">
<dxg:GridColumn" Header="{Binding LanguageTexts[_MaterialNumber]}">
<dxg:GridColumn.CellTemplate>
<DataTemplate>
<ComboBox Name="ComboBox" ItemsSource="{Binding SelectedDelivery.MaterialList}" SelectedIndex="0" />
</DataTemplate>
</dxg:GridColumn.CellTemplate>
</dxg:GridColumn>
我的 ComboBox 不显示任何内容。我猜有什么问题,因为我使用了 Itemssource 中的 DataContext。 希望你能帮助我!
【问题讨论】: