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

The Archive Base Latest Questions

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

Here ‘s the documentation. I haven’t found any explanation anywhere. There is a data

  • 0

Here‘s the documentation. I haven’t found any explanation anywhere. There is a data binding overview but is for WPF, and I’m using WinForms. I thought what it does is to call whatever method I assign to the event Format of the Binding class, but it will call it even if I set formattingEnabled to false as long as I assign a method. So now I don’t know what it does, and I don’t understand where is people supposed to get this kind of information.

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

    It looks like you need a couple pieces… First here’s the Reflector’d bit on the Format event that you’ve added

    protected virtual void OnFormat(ConvertEventArgs cevent)
    {
        if (this.onFormat != null)
        {
            this.onFormat(this, cevent);
        }
        if (((!this.formattingEnabled && !(cevent.Value is DBNull)) && ((cevent.DesiredType != null) && !cevent.DesiredType.IsInstanceOfType(cevent.Value))) && (cevent.Value is IConvertible))
        {
            cevent.Value = Convert.ChangeType(cevent.Value, cevent.DesiredType, CultureInfo.CurrentCulture);
        }
    }
    

    and then there’s this:

    private object FormatObject(object value)
    {
        if (this.ControlAtDesignTime())
        {
            return value;
        }
        Type propertyType = this.propInfo.PropertyType;
        if (this.formattingEnabled)
        {
            ConvertEventArgs args = new ConvertEventArgs(value, propertyType);
            this.OnFormat(args);
            if (args.Value != value)
            {
                return args.Value;
            }
            TypeConverter sourceConverter = null;
            if (this.bindToObject.FieldInfo != null)
            {
                sourceConverter = this.bindToObject.FieldInfo.Converter;
            }
            return Formatter.FormatObject(value, propertyType, sourceConverter, this.propInfoConverter, this.formatString, this.formatInfo, this.nullValue, this.dsNullValue);
        }
        ConvertEventArgs cevent = new ConvertEventArgs(value, propertyType);
        this.OnFormat(cevent);
        object obj2 = cevent.Value;
        if (propertyType == typeof(object))
        {
            return value;
        }
        if ((obj2 != null) && (obj2.GetType().IsSubclassOf(propertyType) || (obj2.GetType() == propertyType)))
        {
            return obj2;
        }
        TypeConverter converter2 = TypeDescriptor.GetConverter((value != null) ? value.GetType() : typeof(object));
        if ((converter2 != null) && converter2.CanConvertTo(propertyType))
        {
            return converter2.ConvertTo(value, propertyType);
        }
        if (value is IConvertible)
        {
            obj2 = Convert.ChangeType(value, propertyType, CultureInfo.CurrentCulture);
            if ((obj2 != null) && (obj2.GetType().IsSubclassOf(propertyType) || (obj2.GetType() == propertyType)))
            {
                return obj2;
            }
        }
        throw new FormatException(SR.GetString("ListBindingFormatFailed"));
    }
    

    So it’s still going to format the object according to what you’ve bound to the Format event handler.

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

Sidebar

Related Questions

Here the total height of all <div> 's are 900 pixels, but the jQuery
Here's the method. I want to know if I am violating any best practices
Here is my simplified data structure: Object1.h template <class T> class Object1 { private:
Here's what I'm trying to do... It's quite simple and obviously there must be
Here is the scenario: I'm writing an app that will watch for any changes
Here's my situation: I have a Data Template set up which contains a ToggleButton
Here's some CSS and HTML to make a textarea below a list of data
Here's a very simple repro: Start up VS2010 or VS2008, new a WPF project
Here's my proposed (very simplified to illustrate the problem space) design for a C#
Here is a complete example. I want to forbid using A::set from objects casted

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.