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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:12:50+00:00 2026-05-13T23:12:50+00:00

I have a class, SerializableColor, to allow me to XML serialize Colors. public class

  • 0

I have a class, SerializableColor, to allow me to XML serialize Colors.

public class SerializableColor
{

    // omitted constructors, etc. ...

    [XmlIgnore]
    public Color Color
    {
        get { return Color.FromArgb(this.Alpha, this.Red, this.Green, this.Blue); }
        set
        {
            this.Alpha = value.A;
            this.Red = value.R;
            this.Green = value.G;
            this.Blue = value.B;
        }
    }

    public int Alpha { get; set; }
    public int Red { get; set; }
    public int Green { get; set; }
    public int Blue { get; set; }
}

Now, for example, consider a class Foo:

public class Foo 
{
    public SerializableColor SColor { get; set; }
}

I want to databind some WinForm Control properties to this class.
When I first add the databinding, everything works fine, but any changes are not correctly propogated.

For example, if I bind a Control’s BackColor to SColor, the BackColor will be correctly updated, etc. However, if I then go and change the BackColor, the change will not be propogated to the Foo object’s SColor. And if I change the Foo object’s SColor, the change will not be seen on the Control’s BackColor.

Databinding to a plain Color property works as desired. Just not to a SerializableColor.

Where am I going wrong?

  • 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-13T23:12:51+00:00Added an answer on May 13, 2026 at 11:12 pm

    You need to make your SerializableColor class implement INotifyPropertyChanged.

    You should also make Foo implement it if SColor is changed to a new color instance entirely.

    Also, you should really implement a TypeConverter if you want Windows Forms to be able to bi-directionally convert to/from your SerializedColor type.

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

Sidebar

Related Questions

I have class public class Class2 { public string myName { get; set; }
I have class public class Chat { public string Ip { get; set; }
I have class A: public class ClassA<T> Class B derives from A: public class
I have class with internal property: internal virtual StateEnum EnrolmentState { get { ..getter
I have class A: public B { ...} vector<A*> v; I want to do
I have class which implements Countable, ArrayAccess, Iterator and Serializable. I have a public
I have class like public class ProgressBars { public ProgressBars() { } private Int32
I have: class A { public: B toCPD() const; And: template<typename T> class Ev
I have class that extends BroadcastReceiver and gets all new sms. When I get
I have class ObjectController { public: ... template<template<class> class Action, class T> Action<T> *

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.