[Mono-bugs] [Bug 664827] A control property's XXXIsNull property isn't set when no items are in the data source.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Jan 16 16:47:33 EST 2011


https://bugzilla.novell.com/show_bug.cgi?id=664827

https://bugzilla.novell.com/show_bug.cgi?id=664827#c1


--- Comment #1 from Clinton Volzke <cvolzke at live.com.au> 2011-01-16 21:47:32 UTC ---
These changes fix the issue and causes the unit test above to pass:

Code added to Binding:
    private PropertyDescriptor control_is_null_desc;

Code added to Binding.SetControl:
    control_property = TypeDescriptor.GetProperties(control).Find
(property_name, true);
    control_is_null_desc =
TypeDescriptor.GetProperties(control).Find(property_name + "IsNull", true); //
like added

Code added to Binding.PullData:
    #if NET_2_0
        if (data == null)
            data = datasource_null_value;
    #endif
        if (control_is_null_desc != null &&
(bool)control_is_null_desc.GetValue(control)) // line added
            data = datasource_null_value; // line added

Code added to Binding.SetControlValue:
    private void SetControlValue (object data)
    {
        if (control_is_null_desc != null && // line added
            (data == null || data is DBNull || object.Equals(data,
datasource_null_value))) // line added
            control_is_null_desc.SetValue(control, true); // line added
        else // line added
        {
            control_property.SetValue(control, data);
        }
    }

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list