布局代码: <ListBox  Name="listBox1" Width="120" Height="52"  SelectionChanged="listBox1_SelectionChanged" >

<ListBoxItem Tag="Red1">Red</ListBoxItem>

<ListBoxItem Tag="Yellow1">Yellow</ListBoxItem>

<ListBoxItem>Blue</ListBoxItem>

</ListBox>
后台代码:
 ((ListBoxItem)listBox1.SelectedItem).Content;可以获取里面的内容:Red,Yellow,Blue。

 ((ListBoxItem)listBox1.SelectedItem).Tag,可以获取Tag值。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
  • 2021-10-11
  • 2022-01-18
  • 2022-12-23
  • 2022-12-23
  • 2021-11-21
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-16
  • 2022-12-23
相关资源
相似解决方案