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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:55:33+00:00 2026-05-27T20:55:33+00:00

I’m working with the WPF Extended Toolkit’s Property Editor, and I need to add

  • 0

I’m working with the WPF Extended Toolkit’s Property Editor, and I need to add support for editing System.Drawing.Color using the color editor that comes with this Toolkit.

The current color editor does its job via a Color Picker component, and seems to use data binding to wire up the Color Picker’s SelectedColor property directly to the edited object’s color property. Unfortunately the Toolkit’s editors are implemented by returning a DependencyProperty to bind to, rather than by being asked to bind it themselves, so it doesn’t seem I can insert the (absolutely trivial) type conversion there.

I see only two other ways of doing this:

  • duplicate the entire Color Picker, changing the type of the property it edits. This is the last thing I want to do for obvious reasons.
  • expose a second Color property from the Color Picker, of the type System.Drawing.Color, so that my new color editor can tell the property grid to bind to that one. But I’ve been told that having two dependency properties with the same underlying value is a terrible idea.

Is there a better way?

If I really should expose two kinds of Color properties in the Color Picker component, what’s the correct way to keep them “in sync”?

  • 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-05-27T20:55:34+00:00Added an answer on May 27, 2026 at 8:55 pm

    You can data bind to a System.Drawing.Color using a value converter. This works in my test environment.

    public class SystemDrawingColorConverter : IValueConverter
    {
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            System.Windows.Media.Color color = (System.Windows.Media.Color)value;
            return System.Drawing.Color.FromArgb(color.A, color.R, color.G, color.B);
        }
    
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            System.Drawing.Color color = (System.Drawing.Color)value;
            return System.Windows.Media.Color.FromArgb(color.A, color.R, color.G, color.B);
        }
    }
    

    The XAML:

    <Grid>
        <Grid.Resources>
            <local:SystemDrawingColorConverter x:Key="converter" />
        </Grid.Resources>
        <Grid.DataContext>
            <local:VM />
        </Grid.DataContext>
        <tk:ColorPicker SelectedColor="{Binding Color, Converter={StaticResource converter}}" />
    </Grid>
    

    code for the test view model:

    public class VM
    {
        private System.Drawing.Color _color;
    
        public System.Drawing.Color Color
        {
            get { return _color; }
            set { _color = value; }
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have thousands of HTML files to process using Groovy/Java and I need to
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

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.