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 with back reference: public class Employee : Entity { private string
I have class with collection as below public class MyClass:IXmlSerializable { int vesrion; private
I have class: public class ConferenceListFragment extends SherlockListFragment { @Override public void onActivityCreated(Bundle savedInstanceState)
I have class called Database. public class Database { public Connection connect = null;
I have class: public class EnglishWord implements Serializable, Comparable, Cloneable { static Logger logger
i have class, with fields of double? type. with reflection i get fields Parameters
I have class Lazy which lazily evaluates an expression: public sealed class Lazy<T> {
I have: class A{ public $name = 'A'; public $B; public function B_into_A($b) {
I have: class T {}; class S: public T {}; vector<T*> v; vector<S*> w;
I have class Errors. I have value errorCode. I need get string by errorCode.

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.