I have been attempting to populate a multiselectlist with the colors supported in WP7.1, but I am having issues generating a list of these colors in code behind. So far, my solution is as follows:
ColorListPage.xaml
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<toolkit:MultiselectList x:Name="ColorList" ItemsSource="{Binding}" Height="88" HorizontalAlignment="Left" VerticalAlignment="Top" >
<DataTemplate>
<StackPanel Orientation="Horizontal" Margin="16,21,0,20">
<Rectangle Fill="{Binding}" Width="50" Height="50"/>
<TextBlock Text="{Binding}" Margin="12,10,0,0"/>
</StackPanel>
</DataTemplate>
</toolkit:MultiselectList>
and I am attempting to databind to the rectangle and textblock properties such that the rectangle will be filled with a solidcolorbrush value and the textblock will contain the name of the respective solidcolorbrush. This is where I am stuck, as I cannot figure out how to accomplish this? Specifically, I am not trying to call the accent colors, but all of the color options available (for instance seen when setting the fill of the rectangle explicity there is a huge list of options).
Do you want a MultiSelectList or a ListPicker? Do you want the user to be able to choose more than one color? Here is an example that uses a ListPicker. To get the colors, you will have to create the colors yourself. Here is a sample using accent colors
The xaml for the ListPicker:
And the code to generate the collection of colors:
You could also use reflection to get the collection of colors.