Example #1
0
        public PackageSearchToolbar()
        {
            root = Resources.GetTemplate("PackageSearchToolbar.uxml");
            Add(root);
            root.StretchToParentSize();

            SearchTextField.value                 = searchText;
            SearchTextField.maxLength             = 54;
            SearchCancelButton.clickable.clicked += SearchCancelButtonClick;

            RegisterCallback <AttachToPanelEvent>(OnEnterPanel);
            RegisterCallback <DetachFromPanelEvent>(OnLeavePanel);

            searchText = PackageSearchFilter.Instance.SearchText;

            if (string.IsNullOrEmpty(searchText))
            {
                showingPlaceHolder    = true;
                SearchTextField.value = kPlaceHolder;
                SearchTextField.AddToClassList("placeholder");
            }
            else
            {
                showingPlaceHolder    = false;
                SearchTextField.value = searchText;
                SearchTextField.RemoveFromClassList("placeholder");
            }
        }
Example #2
0
 private void OnSearchTextFieldFocusOut(FocusOutEvent evt)
 {
     if (string.IsNullOrEmpty(searchText))
     {
         showingPlaceHolder = true;
         SearchTextField.AddToClassList("placeholder");
         SearchTextField.value = kPlaceHolder;
     }
 }
Example #3
0
        private void SearchCancelButtonClick()
        {
            if (!string.IsNullOrEmpty(SearchTextField.value))
            {
                SearchTextField.value = string.Empty;
            }

            showingPlaceHolder = true;
            SearchTextField.AddToClassList("placeholder");
            SearchTextField.value = kPlaceHolder;
        }
Example #4
0
 public void SetSearchText(string text)
 {
     searchText = text;
     if (string.IsNullOrEmpty(searchText))
     {
         showingPlaceHolder    = true;
         SearchTextField.value = kPlaceHolder;
         SearchTextField.AddToClassList("placeholder");
     }
     else
     {
         showingPlaceHolder    = false;
         SearchTextField.value = searchText;
         SearchTextField.RemoveFromClassList("placeholder");
     }
 }