Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8020443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:41:38+00:00 2026-06-04T21:41:38+00:00

I have been attempting to populate a multiselectlist with the colors supported in WP7.1,

  • 0

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).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T21:41:39+00:00Added an answer on June 4, 2026 at 9:41 pm

    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:

            <toolkit:ListPicker x:Name="ColorPicker" ExpansionMode="FullScreenOnly"
                                FullModeHeader="COLOR"
                                Visibility="Collapsed"
                                ItemsSource="{Binding Brushes}"
                                SelectedItem="{Binding SelectedBrush, Mode=TwoWay}">
                <toolkit:ListPicker.FullModeItemTemplate>
                    <DataTemplate>
                        <StackPanel Margin="0 20" Orientation="Horizontal">
                            <Rectangle Width="42" Height="42" Fill="{Binding Brush}"
                                   Stroke="{StaticResource PhoneForegroundBrush}"
                                   HorizontalAlignment="Left"/>
                            <TextBlock Text="{Binding Name}" Style="{StaticResource PhoneTextExtraLargeStyle}"
                                       HorizontalAlignment="Center" Margin="5,0"/>
                        </StackPanel>
                    </DataTemplate>
                </toolkit:ListPicker.FullModeItemTemplate>
            </toolkit:ListPicker>
    

    And the code to generate the collection of colors:

    private IList<ColorItem> CreateBrushes()
        {
            var brushes = new List<ColorItem>
            {
                new ColorItem { Brush = new SolidColorBrush(Color.FromArgb(255,27,161,226)), Name = "blue" },    
                new ColorItem { Brush = new SolidColorBrush(Color.FromArgb(255,160,80,0)), Name = "brown" },     
                new ColorItem { Brush = new SolidColorBrush(Color.FromArgb(255, 51,153,51)), Name = "green" },   
                new ColorItem { Brush = new SolidColorBrush(Color.FromArgb(255,162,193,57)), Name = "lime" },   
                new ColorItem { Brush = new SolidColorBrush(Color.FromArgb(255,216,0,115)), Name = "magenta" }, 
                new ColorItem { Brush = new SolidColorBrush(Color.FromArgb(255,240,150,9)), Name = "mango" },   
                new ColorItem { Brush = new SolidColorBrush(Color.FromArgb(255,230,113,184)), Name = "pink" },  
                new ColorItem { Brush = new SolidColorBrush(Color.FromArgb(255,162,0,255)), Name = "purple" },  
                new ColorItem { Brush = new SolidColorBrush(Color.FromArgb(255,229,20,0)), Name = "red" },      
                new ColorItem { Brush = new SolidColorBrush(Color.FromArgb(255,0,171,169)), Name = "teal" },    
            };
            return brushes;
        }
    
    
    
    public class ColorItem
    {
        public SolidColorBrush Brush { get; set; }
        public string Name { get; set; }
    }
    

    You could also use reflection to get the collection of colors.

            Type t = typeof(Colors);
            var properties = t.GetProperties();
            List<ColorItem> items = new List<ColorItem>();
    
            for (int i = 0; i < properties.Length; i++)
            {
                var property = properties[i];
                items.Add(new ColorItem
                {
                    Name = property.Name,
                    Color = new SolidColorBrush((Color)property.GetValue(null, null))
                });
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been attempting to debug my program, but it always seems to get
Here is my code, I have been attempting to find a way to do
I have been attempting to use an android.preference.DialogPreference inflated from XML, but the documentation
I have been attempting to split a div into two columns using CSS, but
This question might be a bit long and specific, but I have been attempting
I have been attempting to dive into RSpec 2 but its auto generated controller
I have been attempting to use ASP.NET MVC remote validation for username login access
I have been attempting to learn Grails, however I am running into the following
I have been attempting to write a VBA Script that can parse out other
I have been attempting to have a object that I can use across multiple

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.