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
335
Preserve null value in XamTextEditor
posted

How can I convince XamTextEditor to preserve existing null value if user didn't change anything, instead of setting it to empty string on lost focus.

<igEditors:XamTextEditor Text="{Binding Value, UpdateSourceTrigger=LostFocus}" />

I've tried handling EditModeEnding event:

if (string.IsNullOrEmpty(editor.Text) && UnwrapNull(editor.OriginalValue) == null)
{
    e.Cancel = true;
}

But it still sets "" on binding source.

Also, I want to be able to set empty string if that is a result of user edit (eg. user selected everything and pressed backspace) so I can't use converter on binding to change "" into null and above method even if it worked wouldn't solve my problem completely.