0
我建在Silverlight内部文件的门户风格的应用程序,Silverlight过滤数据复选框像pivotviewer?
我需要能够将文件按类别使用复选框像pivotviewer过滤:
要显示的类别即时通讯使用的ItemsControl和现在使用的哈克变通方法来存储类别ID ..这样的文件,可以添加和删除appropriaely当出头检查或未经检查:
<ItemsControl x:Name="categoryList" ItemsSource="{Binding}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="2">
<CheckBox Checked="categoryIncluded" Unchecked="categoryExcluded" Content="{Binding ID}">
<CheckBox.ContentTemplate>
<DataTemplate>
<!-- This is a hack, content is being used to store the id of the category -->
</DataTemplate>
</CheckBox.ContentTemplate>
</CheckBox>
<TextBlock Foreground="#FFC2BDBD" Text="{Binding Name}"/>
</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
这似乎是一个庞大的黑客,
这是通常在Silverlight中完成的吗?
(我使用RIA数据服务的方式)
好的建议自定义控件..只是想知道如果theres已经是这样做的一种方式? – 2011-03-15 16:33:06
你可以用你的viewmodel绑定IsCheked属性来做到这一点,并通知过滤器当这个变化,因为你在你的viewmodel youalredy有id值存在 – kalvis 2011-03-15 16:40:59
很酷的感谢..我结束了子类化复选框,只是添加字段:) – 2011-03-15 16:47:57