Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
240
Reset object to null
posted

A question about using the reset button.

We have an object that the xammulticolumncomboeditor is bound to. The object has a couple of properties that we are using with the editor: a "name" of type string that we are using in the displaymemberpath, and an "id" of type int (non-nullable) that is used to identify the object as unique. When using reset on this object, it correctly sets the name to null, but it sets the id to 0. What we need is for it to null out the entire object. Is this possible? Or will I need to tackle this in a different way, maybe through a behavior? Another possibility to keep things simple would be to have the ability to set the id to -1, but I'm not convinced of that being the best way to handle this.

Parents
  • 34810
    Suggested Answer
    Offline posted

    Hello nwnerd,

    It sounds like what is happening in this case is that your reset button in the XamMultiColumnComboEditor is doing a member-wise clear of your underlying bound object, and since the "int" type is not nullable, it reverts back to it's default value of 0. One thing I am unsure of in this case, though, is what you actually have this object bound to in the XamMultiColumnComboEditor. I have tried on my end to reproduce this behavior that you are referring to by binding a custom object to the SelectedItem property of the editor and clicking the reset button, but this sets the underlying object to null on my end.

    Would it be possible for you to please provide some additional information about your scenario regarding which property on the XamMultiColumnComboEditor you have your underlying object bound to? I have also attached the sample project I have used to test this, which shows the underlying object that the SelectedItem is bound to getting set to null, rather than doing a member-wise reset.

    Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Associate Developer

    MultiComboResetButtonTest.zip
Reply Children