gpt4 book ai didi

c# - WPF ComboBox ItemsSource 不工作

转载 作者:太空宇宙 更新时间:2023-11-03 20:03:57 25 4
gpt4 key购买 nike

我是 WPF 新手,正在尝试修复现有程序。有一个 ComboBox 定义为:

<ComboBox Height="23" Margin="111.5,6.738,6,0" Name="comboBoxDocType" VerticalAlignment="Top" FontFamily="Calibri" FontSize="11" SelectedIndex="0" SelectionChanged="comboBoxDocType_SelectionChanged" ItemsSource="{Binding}">

尝试在后面的代码中填充它:

DocumentTypesList = new List<string>();
DocumentTypesList.Add(DocumentTypes.Unknown);
DocumentTypesList.Add(DocumentTypes.PurchaseOrder);
DocumentTypesList.Add(DocumentTypes.RMInvoice);
DocumentTypesList.Add(DocumentTypes.SundryOne);
DocumentTypesList.Add(DocumentTypes.DevelopmentPaper);
comboBoxDocType.ItemsSource = DocumentTypesList;

ComboBox 中没有任何内容。有什么东西不见了吗?

最佳答案

ItemsSource="{Binding}" 在此上下文中是不必要的。

关于c# - WPF ComboBox ItemsSource 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25200914/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com