【发布时间】:2011-07-20 08:33:01
【问题描述】:
我有以下 XAML:
...
<ListBox Name ="RoomsListBox" Height="100"
HorizontalAlignment="Left" Margin="12,41,0,0"
VerticalAlignment="Top" Width="120"></ListBox>
...
还有下面的C#代码:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
RoomsListBox.ItemsSource = new[] { new { Name = "First1" },
new { Name = "First2" } };
RoomsListBox.DisplayMemberPath = "Name";
}
问题是我的 ListBox 有项目但它们是空的。为什么我没有看到“First1”和“First2”?
【问题讨论】:
标签: c# .net silverlight binding listbox