WPF listbox中Checkbox横向排列
2013-08-28 15:58 by swarb, ... 阅读, ... 评论, 收藏, 编辑<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<CheckBox Margin="5" Content="{Binding Name}"></CheckBox>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
//资料来源:
http://hi.baidu.com/goldou_com/item/97e6b70305dfd339f3eafcde
<ListBox HorizontalAlignment="Right" Name="listBox1" VerticalAlignment="Top" Width="750" Height="600" ScrollViewer.VerticalScrollBarVisibility="Disabled">
<ListBox.Template>
<ControlTemplate TargetType="{x:Type ListBox}">
<WrapPanel Orientation="Horizontal" IsItemsHost="True"/>
</ControlTemplate>
</ListBox.Template>
<ListBox.ItemTemplate >
<DataTemplate>
<Image Source="{Binding Path=karl }" Height="120" Width="150" ></Image>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>