【发布时间】:2012-08-08 11:36:43
【问题描述】:
我有一个列表框,其中的项目包含复选框:
我想为用户选择的每个 CheckBox 获取字符串 Content
<ListBox Name="SendCodecsNamelistBox"
Height="52"
Margin="150,128,31,65"
ItemsSource="{Binding .}">
<ListBox.ItemTemplate>
<DataTemplate>
<CheckBox Content="{Binding Path=.}" />
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
【问题讨论】:
-
绑定什么?最好从支持 UI 的数据源中获取所需的信息,而不是直接从 UI 中获取信息。