【发布时间】:2022-01-03 10:05:51
【问题描述】:
enter image description here 请检查图像。
列表框中的模板中有一个复选框,我在里面设置了红色背景色。
当我点击红色复选框时工作正常。
但是当我点击图像黑色箭头时,它没有被选中。
如何清除空格并将其与复选框同步?
我尝试设置边距但无法解决。
<ListBox x:Name="xList" Grid.Row="1" HorizontalContentAlignment="Stretch">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Vertical" IsItemsHost="True" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Background="red">
<CheckBox IsChecked="{Binding IsVisible, Mode=TwoWay}"
VerticalContentAlignment="Center"
Content="{Binding Header}"
Height="28" />
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
谢谢你帮助我。
【问题讨论】:
标签: wpf xaml checkbox listbox margin