列表框不显示项目 [英] Listbox does not display items
问题描述
大家好,
很抱歉遇到一个可能是简单问题的错误,但是我在XAML文件中定义了一个列表框,并将其绑定到ObservableObjects列表,它实际上只是一个字符串列表.麻烦的是,当对话框出现时,列表框存在并且为空.
Sorry to bug with what is likely a simple issue, but I've defined a Listbox in my XAML file and I've bound it to a List of ObservableObjects which is really just a list of strings. Trouble is, when the dialog appears, the Listbox is present and is blank.
从XAML:
< ListBox Name =" NameList" Grid.Column ="1". Grid.Row ="10". Grid.RowSpan ="10".宽度="220". HorizontalAlignment =左" ItemsSource =""{绑定 名称}"/">
<ListBox Name="NameList" Grid.Column="1" Grid.Row="10" Grid.RowSpan="10" Width="220" HorizontalAlignment="Left" ItemsSource="{Binding Names}"/>
从我的ViewModel:
From my ViewModel:
推荐答案
其他信息(以防万一).该列表在ComboBox和TreeView中都显示良好.
Additional info in case it helps. The list shows up fine in both a ComboBox and a TreeView.
这篇关于列表框不显示项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!