如何检索列表框中所有选中项目的列表? Silverlight WP7.1
这是我的列表框,如何在代码隐藏中检索已检查的项目?
<ListBox Name="AppointmentResultsData" ItemsSource="{Binding Path=Attendees}" Height="400" ScrollViewer.ManipulationMode="Control" Margin="24,0,0,0" >
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<CheckBox Content="{Binding Path=DisplayName, Mode=TwoWay}" FontSize="{StaticResource PhoneFontSizeExtraLarge}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Button Content="Skicka" Click="SendPhoto_Click" HorizontalAlignment="Center" />
This is my listbox, how can I retrieve the items that has been checked, in code-behind ?
<ListBox Name="AppointmentResultsData" ItemsSource="{Binding Path=Attendees}" Height="400" ScrollViewer.ManipulationMode="Control" Margin="24,0,0,0" >
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<CheckBox Content="{Binding Path=DisplayName, Mode=TwoWay}" FontSize="{StaticResource PhoneFontSizeExtraLarge}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Button Content="Skicka" Click="SendPhoto_Click" HorizontalAlignment="Center" />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
检查是否可以解决您的问题:
How to get Selected items in WPF CheckBox ListBox视图模型方法。
通常推荐使用
Check if that solves your problem:
How to get Selected items in WPF CheckBox ListBox
View model approach is usually recommended.
列表框是 IEnumerable。我实际上还没有编译这个,但是类似:
The listbox is IEnumerable. I haven't actually compiled this, but something like: