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 154429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:58:38+00:00 2026-05-11T09:58:38+00:00

Long ago, I looked at this MSDN walkthrough . It implements a color editor,

  • 0

Long ago, I looked at this MSDN walkthrough. It implements a color editor, and the tooltip uses the color’s name like ‘Red’ or ‘Blue’.

Today, I’m implementing a ListBox that is similar; it displays a box with the color and the name of the color next to it. Except in my application, all of the color names display as the hex values like #FFFF0000 and #FF0000FF. Why?

Here’s the ColorsList class used in both projects:

public ColorsList() {     Type type = typeof(Colors);     foreach (PropertyInfo propertyInfo in type.GetProperties(BindingFlags.Public | BindingFlags.Static))     {         if (propertyInfo.PropertyType == typeof(Color))         {             Add((Color)propertyInfo.GetValue(null, null));         }     } } 

This XAML snippet makes the tooltip use the color name in the MSDN project (you can see the rest of the code in the walkthrough):

<ItemsControl.ItemTemplate>     <DataTemplate>         <Button Tag='{Binding}' Command='{x:Static PropertyEditing:PropertyValueEditorCommands.ShowInlineEditor}'>             <Button.Template>                 <ControlTemplate>                     <Border Width='30' Height='30' BorderBrush='Black' BorderThickness='1' CornerRadius='5'>                         <Rectangle Width='22' Height='22' ToolTip='{Binding}'>                             <Rectangle.Fill>                                 <SolidColorBrush Color='{Binding}'/>                             </Rectangle.Fill>                         </Rectangle>                     </Border>                 </ControlTemplate>             </Button.Template>         </Button>     </DataTemplate> </ItemsControl.ItemTemplate> 

Here’s my XAML that produces the hex codes:

<ListBox x:Name='lstColors' Grid.Row='1' ItemsSource='{StaticResource colors}'>     <ListBox.ItemTemplate>         <DataTemplate>             <StackPanel Orientation='Horizontal'>                 <Rectangle Stroke='Black'                            StrokeThickness='3'                            Width='24'                            Height='24'                            RadiusX='5'                            RadiusY='5'>                     <Rectangle.Fill>                         <SolidColorBrush Color='{Binding}' />                     </Rectangle.Fill>                 </Rectangle>                 <TextBlock Text='{Binding}' />             </StackPanel>         </DataTemplate>     </ListBox.ItemTemplate> </ListBox> 

It looks the same to me; what’s the difference?

  • 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. 2026-05-11T09:58:38+00:00Added an answer on May 11, 2026 at 9:58 am

    It turns out design-time is different from run-time. The MSDN example is used as an extended property editor. I took a friend’s advice and tried exposing it as a runtime control, and magically it’s getting hash names for colors instead of friendly names. Neat.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

not so long ago i found out that you can do this in css
This enum used to exist not too long ago. I am upgrading to Castle
It seems like not so long ago that it was standard to have icons/images
Not too long ago, I installed a java web application on a Red Hat
I remember long ago there is option to change color-scheme for source on BitBucket.
I got this idea a long time ago when i saw an app do
I Google'd not long ago and came across this solution to loop out information
I was asked this question not too long ago, and didn't have a good
Not long ago developed a system based on compact framework for Windows Mobile Professional
Not so long ago I started to learn to use System.Reflection.Emit namespace. I'm now

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.