【发布时间】:2011-01-20 14:01:11
【问题描述】:
我有一个列表框
<ListBox Width="400" Height="150" x:Name="QuestionsBox" Margin="0,0,0,40">
<ListBoxItem Name="Item1" Content="Hello"></ListBoxItem>
<ListBoxItem Name="Item2" Content="Hello"></ListBoxItem>
</ListBox>
我想在列表框中显示项目被选中时的内容。就像,如果用户选择 Item1 那么我应该能够获得内容 - 你好
我尝试使用 SelectedItem 属性 [QuestionsBox.SelectedItem],但我似乎没有在运行时获得内容的值。
请帮忙
【问题讨论】:
标签: c# silverlight-3.0 listbox