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
790
XamTextEditor
posted

Hello,

I have a search box which is a XamTextEditor. I set it's Null value to "search"

The problem is that when i am typing something in it, everything works. But when i try to clear the text (clear the last character in the textEditor or clear all of it), it isn't cleared and the last char is remained in the box.

I bind the TextEditor to a string property this way:

 private string searchText;
 
        public string SearchText
        {
            set
            {
                if (searchText != value)
                {
                    searchText = value;
                    if (!string.IsNullOrEmpty(value))
                    {
                        SearchAllViewModel.SetSearchText(searchText);
                    }
                    else
                    {
                        searchText = null;
                        SearchAllViewModel.ClearSearchText();
                    }
                    SendPropertyChanged(() => SearchText);
                }
            }
            get
            {
                return searchText;
            }
        }

If i remove the "else" code, it works and i am able to clear the box. but with "else" code i can't