Home Forums WinForms controls Other WinForms controls Binding and WinDatePicker

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #18138 |

    I’m having a really weird issue with WinDatePicker and binding.

    1st of all I’m trying to make a “new” control based on it; so here is the most basic version of the source

    class ClarionDateEditBox : Xceed.Editors.WinDatePicker
    {

    public object _Original = “”;
    public object Original
    {
    get { return (_Original); }
    set { _Original = value; }
    }

    // Resets iValue to the proper Clarion Date Number on a change
    private void CDValueChanged(object sender, EventArgs e)
    {
    return;
    }

    public ClarionDateEditBox() : base() {
    this.ValueChanged += new EventHandler(this.CDValueChanged);
    }
    }

    I am binding to the “Original” value with a string value (and the getting/setting works fine). However, even though it sets it properly when the record is loaded — once I TAB off the windatepicker control the Get is fired (I assume to update the row) —

    AND THEN here is where the issue appears to occur. Right after the GET a SET is fired with a blank value. It doesn’t matter if I “Eat” the set; the underlying value in the row is already changed to blank. Something in the WinDatePicker is changing the underlying row value to a blank string which of course fires the set with a blank string.

    I replaced the WinDatePicker with a TextBox and it worked the way I expected it; and the value stayed in the row properly.

    Is their something I’m missing with binding and the WinDatePicker control; or is this just some underlying bug in it that I can’t work around?

    Unless their is another “easier” way to do this (I can’t do this in the select statement) — the reason I need to create a subclassed control and bind it to a different value is some legacy data support; Clarion Dates are stored as the number of days since 1800. So I have code that converts the “SET” string number into an integer, then adds the proper math to convert it into a NET DataTime field. Then I assign that “DateTime” to the Value so that the WinDatePicker has a DateField. I reverse the process when I “GET” the original value. This works find with a TextBox; but as you see from the boiled down example above the WinDatePicker does something screwy, even if I’m not doing anything with the value except storing it.

    Nathan

    Imported from legacy forums. Posted by Nathanael (had 4543 views)

    User (Old forums)
    Member
    Post count: 23064

    I have “object” as the type in the code (for what “Original/_Original” is), but it normally is a string. That just happened to be my last test to see if changing the type would fix the issue. I should have removed it from the sample above; but the event handler also is unneeded to show the issue.

    I also tried using the [bindable(…)] and that didn’t make any differences….

    Nathan.

    Imported from legacy forums. Posted by Nathanael (had 311 views)

    User (Old forums)
    Member
    Post count: 23064

    Ok, I found a much better way to do the binding by using Format/Parse in the binding to do the conversion to and from my legacy data; so I don’t have to subclass the controls anymore. (Learn something new everyday. :-D)

    However the issue is still the same. Binding to the “Value” propery of the WinDatePicker appears to have issues. Does WDP support Binding? Or am I supposed to Bind to a different Field?

    It is setting the Date in the WDP; however; when I change the date and tab off it has the same basic issues as above. It appears that somewhere lower in the control it is trying to copy the value back to the Source Data in the Data Row. Any way to turn off this functionality.

    Nathan.

    Imported from legacy forums. Posted by Nathanael (had 493 views)

    User (Old forums)
    Member
    Post count: 23064

    Our developer could not reproduce the problem. Can you send a sample application to <a href=”mailto:support@xceedsoft.com”>support</a> so we can investigate the issue further?

    Imported from legacy forums. Posted by André (had 512 views)

    User (Old forums)
    Member
    Post count: 23064

    I just sent a simple boiled down appliction with this problem to priorty support… Thanks for your response.

    Nathan.

    Imported from legacy forums. Posted by Nathanael (had 388 views)

    User (Old forums)
    Member
    Post count: 23064

    This is a bug. The WinDatePicker’s dynamic Bindings always parses to null string when the desired DataType is string.

    The fix for this will be available in our next release, which will be out sometime in September 2006.

    Imported from legacy forums. Posted by André (had 5545 views)

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.