我有一个字典集合,我需要将它绑定到 Silverlight ListBox。我无法使用 Key 值绑定到 ListBox。下面是示例代码..我在后面的代码中得到空记录字典..
Dictionary<DayOfWeek, List<Book>> bookItem = new Dictionary<DayOfWeek, List<Book>>();
<ListBox x:Name="ListValues" ItemsSource="{Binding bookItem}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding BookName[Tuesday]}"></TextBlock>
<TextBlock Text="{Binding BookDesc[Tuesday]}"></TextBlock>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>