列表框与多个控制 [英] Listbox with more than one Control
本文介绍了列表框与多个控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有人可以帮我在创造一个复选框和星级控制水平对齐一个列表框?我使用C#和XAML想为WP7。
Can somebody help me out in creating a listbox with a checkbox and star rating control align horizontally? I want it for WP7 using C# and XAML.
推荐答案
您需要在这里编写一个自定义列表是一个例子:
You need to code a custom list here is an example:
您需要包括ControlToolkit:
You need to include ControlToolkit:
xmlns:ControlsToolkit="clr-namespace:System.Windows.Controls"
和这里是代码:
<ListBox x:Name="listBox" SelectionMode="Multiple"
ItemContainerStyle="StaticResource ListBoxCheckedStyle}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<CheckBox Checked="{Binding YourPropertyPath}"/>
<TextBlock Text="{Binding Name}" Width="150" VerticalAlignment="Center"/>
<ControlsToolkit:Rating Height="50" Grid.Row="0" x:Name="rating" ItemCount="5">
<ControlsToolkit:Rating.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
</ItemsPanelTemplate>
</ControlsToolkit:Rating.ItemsPanel>
</ControlsToolkit:Rating>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
您可以从这里下载示例:
的 DownloadSample
You can download sample from here: DownloadSample
或点击这里查看详细信息:
示例网站
or check details here: Sample site
您可以获得这些详细:
的 CustomDataTemplateSelector
的 WP7经过ListBox中以不同的方式的。
You can get more detail on these: CustomDataTemplateSelector WP7 Checked ListBox in different ways.
这篇关于列表框与多个控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文