【问题标题】:Iterating content of listbox silverlight迭代列表框silverlight的内容
【发布时间】: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


    【解决方案1】:
    <TextBlock Text="{Binding SelectedItem.Content, ElementName=QuestionsBox}" />
    

    【讨论】:

      猜你喜欢
      • 2010-11-18
      • 1970-01-01
      • 2011-03-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多