【发布时间】:2011-03-15 16:20:57
【问题描述】:
我正在 Silverlight 中构建一个内部文件门户样式的应用程序,
我需要能够使用诸如 pivotviewer 中的复选框按类别过滤文件:
要使用 ItemsControl 显示类别,并且目前正在使用一种 hacky 解决方法来存储类别 id.. 因此可以在检查或取消检查时适当地添加和删除文件:
<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 数据服务)
【问题讨论】:
标签: silverlight filtering ria