2
如何爲每個將添加到我的列表框中的項目綁定複選框內容值?從列表框項目中設置複選框文本值
<ListBox BorderThickness="2" Height="389"
HorizontalAlignment="Left" Margin="10,10,0,0"
Name="lboIssues" VerticalAlignment="Top" Width="175"
SelectionMode="Multiple" ItemsSource="{Binding Mode=OneWay}">
然後這裏是我的ItemTemplate
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Margin="0,5,0,5" Orientation="Horizontal" >
<CheckBox Name="checkbox"
Content="{Binding Path=Value, Mode=OneWay}"
VerticalContentAlignment="Center"
Margin="0,0,5,0"
Width="Auto"
IsChecked="{Binding RelativeSource={RelativeSource FindAncestor,
AncestorType={x:Type ListBoxItem}}, Path=IsSelected}"
IsTabStop="False" Checked="FilterCheckbox_CheckChanged"
Unchecked="FilterCheckbox_CheckChanged"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>`
當我檢查,複選框含量值分別爲空白。
的作品就像一個魅力!謝謝bro:D – lexeRoy