I'm building an internal file portal style app in silverlight,
I need to be able to filter the files by category using checkboxes like in pivotviewer:
To display the categories im using a ItemsControl, and am currently using a hacky workaround to store the category id.. so files can be added and removed appropriaely when somethings check or unchecked:
<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>
This seems like a massive hack,
How is this normally done in silverlight?
(I'm using RIA data services by the way)
To avoid that hack you could create custom control that conteins chekbox + other data and id property