Intersoft ClientUI Documentation
UXSearchBox Class
Members  See Also  Send Feedback
Intersoft.Client.UI.Aqua.UXCollection Namespace : UXSearchBox Class






Represents a search box control with built-in dropdown and search button.

Object Model

UXSearchBox Class

Syntax

Visual Basic (Declaration) 
<TemplateVisualStateAttribute(Name="KeyboardUnfocused", GroupName="KeyboardFocusStates")>
<TemplatePartAttribute(Name="ItemsContainer", Type=System.Windows.Controls.Grid)>
<TemplatePartAttribute(Name="RootElement", Type=System.Windows.Controls.Grid)>
<TemplateVisualStateAttribute(GroupName="KeyboardFocusStates", Name="KeyboardFocused")>
<TemplateVisualStateAttribute(GroupName="CommonStates", Name="Disabled")>
<TemplateVisualStateAttribute(GroupName="CommonStates", Name="HighlightFocused")>
<TemplatePartAttribute(Name="PopupElement", Type=Intersoft.Client.UI.Controls.UXPopup)>
<TemplatePartAttribute(Name="FocusVisualElement", Type=System.Windows.Controls.Border)>
<TemplatePartAttribute(Name="DisabledVisualElement", Type=System.Windows.Controls.Border)>
<TemplateVisualStateAttribute(GroupName="FocusStates", Name="Focused")>
<TemplatePartAttribute(Name="KeyboardFocus", Type=System.Windows.Shapes.Rectangle)>
<TemplatePartAttribute(Name="NonEditableElement", Type=System.Windows.Controls.Grid)>
<DescriptionAttribute("Represents a search box control with built-in dropdown and search button.")>
<StyleTypedPropertyAttribute(Property="ScrollViewerStyle", StyleTargetType=Intersoft.Client.UI.Controls.UXScrollViewer)>
<TemplateVisualStateAttribute(GroupName="FocusStates", Name="Unfocused")>
<TemplatePartAttribute(Name="BusyElement", Type=System.Windows.Controls.Grid)>
<TemplatePartAttribute(Name="DropDownButton", Type=Intersoft.Client.UI.Aqua.UXToggleButton)>
<TemplatePartAttribute(Name="BusyTextElement", Type=System.Windows.Controls.Grid)>
<TemplatePartAttribute(Name="BusyTemplateElement", Type=System.Windows.Controls.Grid)>
<TemplatePartAttribute(Name="DropDownTemplateContainer", Type=System.Windows.Controls.Grid)>
<TemplatePartAttribute(Name="ItemsPresenter", Type=System.Windows.Controls.ItemsPresenter)>
<TemplatePartAttribute(Name="InputElement", Type=Intersoft.Client.UI.Controls.UXTextBox)>
<TemplatePartAttribute(Name="EditableElement", Type=System.Windows.Controls.Grid)>
<TemplatePartAttribute(Name="NoResultElement", Type=System.Windows.Controls.Grid)>
<TemplateVisualStateAttribute(GroupName="CommonStates", Name="Normal")>
<TemplatePartAttribute(Name="ScrollElement", Type=Intersoft.Client.UI.Controls.UXScrollViewer)>
<TemplateVisualStateAttribute(GroupName="CommonStates", Name="Pressed")>
<TemplateVisualStateAttribute(GroupName="CommonStates", Name="MouseOver")>
<TemplatePartAttribute(Name="NoResultTextElement", Type=System.Windows.Controls.Grid)>
<TemplatePartAttribute(Name="NoResultTemplateElement", Type=System.Windows.Controls.Grid)>
<StyleTypedPropertyAttribute(Property="ItemContainerStyle", StyleTargetType=Intersoft.Client.UI.Aqua.UXCollection.UXSearchBoxItem)>
<TemplatePartAttribute(Name="ResetButton", Type=Intersoft.Client.UI.Aqua.UXButton)>
Public Class UXSearchBox 
   Inherits UXComboBox
   Implements IControlIFramework, ILicensing, IFocusRedirectionIKeyboardFocusISelection 
Visual Basic (Usage)Copy Code
Dim instance As UXSearchBox
C# 
[TemplateVisualStateAttribute(Name="KeyboardUnfocused", GroupName="KeyboardFocusStates")]
[TemplatePartAttribute(Name="ItemsContainer", Type=System.Windows.Controls.Grid)]
[TemplatePartAttribute(Name="RootElement", Type=System.Windows.Controls.Grid)]
[TemplateVisualStateAttribute(GroupName="KeyboardFocusStates", Name="KeyboardFocused")]
[TemplateVisualStateAttribute(GroupName="CommonStates", Name="Disabled")]
[TemplateVisualStateAttribute(GroupName="CommonStates", Name="HighlightFocused")]
[TemplatePartAttribute(Name="PopupElement", Type=Intersoft.Client.UI.Controls.UXPopup)]
[TemplatePartAttribute(Name="FocusVisualElement", Type=System.Windows.Controls.Border)]
[TemplatePartAttribute(Name="DisabledVisualElement", Type=System.Windows.Controls.Border)]
[TemplateVisualStateAttribute(GroupName="FocusStates", Name="Focused")]
[TemplatePartAttribute(Name="KeyboardFocus", Type=System.Windows.Shapes.Rectangle)]
[TemplatePartAttribute(Name="NonEditableElement", Type=System.Windows.Controls.Grid)]
[DescriptionAttribute("Represents a search box control with built-in dropdown and search button.")]
[StyleTypedPropertyAttribute(Property="ScrollViewerStyle", StyleTargetType=Intersoft.Client.UI.Controls.UXScrollViewer)]
[TemplateVisualStateAttribute(GroupName="FocusStates", Name="Unfocused")]
[TemplatePartAttribute(Name="BusyElement", Type=System.Windows.Controls.Grid)]
[TemplatePartAttribute(Name="DropDownButton", Type=Intersoft.Client.UI.Aqua.UXToggleButton)]
[TemplatePartAttribute(Name="BusyTextElement", Type=System.Windows.Controls.Grid)]
[TemplatePartAttribute(Name="BusyTemplateElement", Type=System.Windows.Controls.Grid)]
[TemplatePartAttribute(Name="DropDownTemplateContainer", Type=System.Windows.Controls.Grid)]
[TemplatePartAttribute(Name="ItemsPresenter", Type=System.Windows.Controls.ItemsPresenter)]
[TemplatePartAttribute(Name="InputElement", Type=Intersoft.Client.UI.Controls.UXTextBox)]
[TemplatePartAttribute(Name="EditableElement", Type=System.Windows.Controls.Grid)]
[TemplatePartAttribute(Name="NoResultElement", Type=System.Windows.Controls.Grid)]
[TemplateVisualStateAttribute(GroupName="CommonStates", Name="Normal")]
[TemplatePartAttribute(Name="ScrollElement", Type=Intersoft.Client.UI.Controls.UXScrollViewer)]
[TemplateVisualStateAttribute(GroupName="CommonStates", Name="Pressed")]
[TemplateVisualStateAttribute(GroupName="CommonStates", Name="MouseOver")]
[TemplatePartAttribute(Name="NoResultTextElement", Type=System.Windows.Controls.Grid)]
[TemplatePartAttribute(Name="NoResultTemplateElement", Type=System.Windows.Controls.Grid)]
[StyleTypedPropertyAttribute(Property="ItemContainerStyle", StyleTargetType=Intersoft.Client.UI.Aqua.UXCollection.UXSearchBoxItem)]
[TemplatePartAttribute(Name="ResetButton", Type=Intersoft.Client.UI.Aqua.UXButton)]
public class UXSearchBox : UXComboBox, IControlIFramework, ILicensing, IFocusRedirectionIKeyboardFocusISelection  
Delphi 
public class UXSearchBox = class(UXComboBox, IControl, IFramework, ILicensing, IFocusRedirection, IKeyboardFocus, ISelection)
JScript 
TemplateVisualStateAttribute(Name="KeyboardUnfocused", GroupName="KeyboardFocusStates")
TemplatePartAttribute(Name="ItemsContainer", Type=System.Windows.Controls.Grid)
TemplatePartAttribute(Name="RootElement", Type=System.Windows.Controls.Grid)
TemplateVisualStateAttribute(GroupName="KeyboardFocusStates", Name="KeyboardFocused")
TemplateVisualStateAttribute(GroupName="CommonStates", Name="Disabled")
TemplateVisualStateAttribute(GroupName="CommonStates", Name="HighlightFocused")
TemplatePartAttribute(Name="PopupElement", Type=Intersoft.Client.UI.Controls.UXPopup)
TemplatePartAttribute(Name="FocusVisualElement", Type=System.Windows.Controls.Border)
TemplatePartAttribute(Name="DisabledVisualElement", Type=System.Windows.Controls.Border)
TemplateVisualStateAttribute(GroupName="FocusStates", Name="Focused")
TemplatePartAttribute(Name="KeyboardFocus", Type=System.Windows.Shapes.Rectangle)
TemplatePartAttribute(Name="NonEditableElement", Type=System.Windows.Controls.Grid)
DescriptionAttribute("Represents a search box control with built-in dropdown and search button.")
StyleTypedPropertyAttribute(Property="ScrollViewerStyle", StyleTargetType=Intersoft.Client.UI.Controls.UXScrollViewer)
TemplateVisualStateAttribute(GroupName="FocusStates", Name="Unfocused")
TemplatePartAttribute(Name="BusyElement", Type=System.Windows.Controls.Grid)
TemplatePartAttribute(Name="DropDownButton", Type=Intersoft.Client.UI.Aqua.UXToggleButton)
TemplatePartAttribute(Name="BusyTextElement", Type=System.Windows.Controls.Grid)
TemplatePartAttribute(Name="BusyTemplateElement", Type=System.Windows.Controls.Grid)
TemplatePartAttribute(Name="DropDownTemplateContainer", Type=System.Windows.Controls.Grid)
TemplatePartAttribute(Name="ItemsPresenter", Type=System.Windows.Controls.ItemsPresenter)
TemplatePartAttribute(Name="InputElement", Type=Intersoft.Client.UI.Controls.UXTextBox)
TemplatePartAttribute(Name="EditableElement", Type=System.Windows.Controls.Grid)
TemplatePartAttribute(Name="NoResultElement", Type=System.Windows.Controls.Grid)
TemplateVisualStateAttribute(GroupName="CommonStates", Name="Normal")
TemplatePartAttribute(Name="ScrollElement", Type=Intersoft.Client.UI.Controls.UXScrollViewer)
TemplateVisualStateAttribute(GroupName="CommonStates", Name="Pressed")
TemplateVisualStateAttribute(GroupName="CommonStates", Name="MouseOver")
TemplatePartAttribute(Name="NoResultTextElement", Type=System.Windows.Controls.Grid)
TemplatePartAttribute(Name="NoResultTemplateElement", Type=System.Windows.Controls.Grid)
StyleTypedPropertyAttribute(Property="ItemContainerStyle", StyleTargetType=Intersoft.Client.UI.Aqua.UXCollection.UXSearchBoxItem)
TemplatePartAttribute(Name="ResetButton", Type=Intersoft.Client.UI.Aqua.UXButton)
public class UXSearchBox extends UXComboBox implements IControlIFramework, ILicensing, IFocusRedirectionIKeyboardFocusISelection 
Managed Extensions for C++ 
[TemplateVisualStateAttribute(Name="KeyboardUnfocused", GroupName="KeyboardFocusStates")]
[TemplatePartAttribute(Name="ItemsContainer", Type=System.Windows.Controls.Grid)]
[TemplatePartAttribute(Name="RootElement", Type=System.Windows.Controls.Grid)]
[TemplateVisualStateAttribute(GroupName="KeyboardFocusStates", Name="KeyboardFocused")]
[TemplateVisualStateAttribute(GroupName="CommonStates", Name="Disabled")]
[TemplateVisualStateAttribute(GroupName="CommonStates", Name="HighlightFocused")]
[TemplatePartAttribute(Name="PopupElement", Type=Intersoft.Client.UI.Controls.UXPopup)]
[TemplatePartAttribute(Name="FocusVisualElement", Type=System.Windows.Controls.Border)]
[TemplatePartAttribute(Name="DisabledVisualElement", Type=System.Windows.Controls.Border)]
[TemplateVisualStateAttribute(GroupName="FocusStates", Name="Focused")]
[TemplatePartAttribute(Name="KeyboardFocus", Type=System.Windows.Shapes.Rectangle)]
[TemplatePartAttribute(Name="NonEditableElement", Type=System.Windows.Controls.Grid)]
[DescriptionAttribute("Represents a search box control with built-in dropdown and search button.")]
[StyleTypedPropertyAttribute(Property="ScrollViewerStyle", StyleTargetType=Intersoft.Client.UI.Controls.UXScrollViewer)]
[TemplateVisualStateAttribute(GroupName="FocusStates", Name="Unfocused")]
[TemplatePartAttribute(Name="BusyElement", Type=System.Windows.Controls.Grid)]
[TemplatePartAttribute(Name="DropDownButton", Type=Intersoft.Client.UI.Aqua.UXToggleButton)]
[TemplatePartAttribute(Name="BusyTextElement", Type=System.Windows.Controls.Grid)]
[TemplatePartAttribute(Name="BusyTemplateElement", Type=System.Windows.Controls.Grid)]
[TemplatePartAttribute(Name="DropDownTemplateContainer", Type=System.Windows.Controls.Grid)]
[TemplatePartAttribute(Name="ItemsPresenter", Type=System.Windows.Controls.ItemsPresenter)]
[TemplatePartAttribute(Name="InputElement", Type=Intersoft.Client.UI.Controls.UXTextBox)]
[TemplatePartAttribute(Name="EditableElement", Type=System.Windows.Controls.Grid)]
[TemplatePartAttribute(Name="NoResultElement", Type=System.Windows.Controls.Grid)]
[TemplateVisualStateAttribute(GroupName="CommonStates", Name="Normal")]
[TemplatePartAttribute(Name="ScrollElement", Type=Intersoft.Client.UI.Controls.UXScrollViewer)]
[TemplateVisualStateAttribute(GroupName="CommonStates", Name="Pressed")]
[TemplateVisualStateAttribute(GroupName="CommonStates", Name="MouseOver")]
[TemplatePartAttribute(Name="NoResultTextElement", Type=System.Windows.Controls.Grid)]
[TemplatePartAttribute(Name="NoResultTemplateElement", Type=System.Windows.Controls.Grid)]
[StyleTypedPropertyAttribute(Property="ItemContainerStyle", StyleTargetType=Intersoft.Client.UI.Aqua.UXCollection.UXSearchBoxItem)]
[TemplatePartAttribute(Name="ResetButton", Type=Intersoft.Client.UI.Aqua.UXButton)]
public __gc class UXSearchBox : public UXComboBox, IControlIFramework, ILicensing, IFocusRedirectionIKeyboardFocusISelection  
C++/CLI 
[TemplateVisualStateAttribute(Name="KeyboardUnfocused", GroupName="KeyboardFocusStates")]
[TemplatePartAttribute(Name="ItemsContainer", Type=System.Windows.Controls.Grid)]
[TemplatePartAttribute(Name="RootElement", Type=System.Windows.Controls.Grid)]
[TemplateVisualStateAttribute(GroupName="KeyboardFocusStates", Name="KeyboardFocused")]
[TemplateVisualStateAttribute(GroupName="CommonStates", Name="Disabled")]
[TemplateVisualStateAttribute(GroupName="CommonStates", Name="HighlightFocused")]
[TemplatePartAttribute(Name="PopupElement", Type=Intersoft.Client.UI.Controls.UXPopup)]
[TemplatePartAttribute(Name="FocusVisualElement", Type=System.Windows.Controls.Border)]
[TemplatePartAttribute(Name="DisabledVisualElement", Type=System.Windows.Controls.Border)]
[TemplateVisualStateAttribute(GroupName="FocusStates", Name="Focused")]
[TemplatePartAttribute(Name="KeyboardFocus", Type=System.Windows.Shapes.Rectangle)]
[TemplatePartAttribute(Name="NonEditableElement", Type=System.Windows.Controls.Grid)]
[DescriptionAttribute("Represents a search box control with built-in dropdown and search button.")]
[StyleTypedPropertyAttribute(Property="ScrollViewerStyle", StyleTargetType=Intersoft.Client.UI.Controls.UXScrollViewer)]
[TemplateVisualStateAttribute(GroupName="FocusStates", Name="Unfocused")]
[TemplatePartAttribute(Name="BusyElement", Type=System.Windows.Controls.Grid)]
[TemplatePartAttribute(Name="DropDownButton", Type=Intersoft.Client.UI.Aqua.UXToggleButton)]
[TemplatePartAttribute(Name="BusyTextElement", Type=System.Windows.Controls.Grid)]
[TemplatePartAttribute(Name="BusyTemplateElement", Type=System.Windows.Controls.Grid)]
[TemplatePartAttribute(Name="DropDownTemplateContainer", Type=System.Windows.Controls.Grid)]
[TemplatePartAttribute(Name="ItemsPresenter", Type=System.Windows.Controls.ItemsPresenter)]
[TemplatePartAttribute(Name="InputElement", Type=Intersoft.Client.UI.Controls.UXTextBox)]
[TemplatePartAttribute(Name="EditableElement", Type=System.Windows.Controls.Grid)]
[TemplatePartAttribute(Name="NoResultElement", Type=System.Windows.Controls.Grid)]
[TemplateVisualStateAttribute(GroupName="CommonStates", Name="Normal")]
[TemplatePartAttribute(Name="ScrollElement", Type=Intersoft.Client.UI.Controls.UXScrollViewer)]
[TemplateVisualStateAttribute(GroupName="CommonStates", Name="Pressed")]
[TemplateVisualStateAttribute(GroupName="CommonStates", Name="MouseOver")]
[TemplatePartAttribute(Name="NoResultTextElement", Type=System.Windows.Controls.Grid)]
[TemplatePartAttribute(Name="NoResultTemplateElement", Type=System.Windows.Controls.Grid)]
[StyleTypedPropertyAttribute(Property="ItemContainerStyle", StyleTargetType=Intersoft.Client.UI.Aqua.UXCollection.UXSearchBoxItem)]
[TemplatePartAttribute(Name="ResetButton", Type=Intersoft.Client.UI.Aqua.UXButton)]
public ref class UXSearchBox : public UXComboBox, IControlIFramework, ILicensing, IFocusRedirectionIKeyboardFocusISelection  

Remarks

UXSearchBox is a full-featured input control that provides search query to search provider.

UXSearchBox does not perform the search query by itself. It requires a search service to retrieve the result. To accomplish this efficiently, UXSearchBox provides several properties that can be used in MVVM pattern development, such as listed in the following.

XAML Copy Code
<Intersoft:UXSearchBox 
    DisplayMemberPath="DisplayName" 
    WatermarkTextVisibility="Visible" WatermarkText="Enter keyword"
    AutoShowResultBox="True" 
    IsSearching="{Binding IsSearching, Mode=TwoWay}" 
    QueryText="{Binding QueryText, Mode=TwoWay}" 
    SearchResult="{Binding SearchResult}" 
    NavigateUriMemberPath="Uri"/>

IsSearching property identifies when the search takes place. You can set the latency that determines the time span to wait before UXSearchBox performs the search query through the QueryLatency property. When UXSearchBox starts a search query, it sets the IsSearching property to true.

You typically perform the search operation in your ViewModel when IsSearching property is changed to true.

C# Copy Code
public bool IsSearching
{
    get { return this._isSearching; }
    set
    {
        if (this._isSearching != value)
        {
            this._isSearching = value;
            this.OnPropertyChanged("IsSearching");
            this.DoSearch();
        }
    }
}

You obtain the search query through the QueryText property, which contains the text that user typed such as shown in the following example.

C# Copy Code
private void DoSearch()
{
    var query = from q in this.Samples
                where
q.DisplayName.ToLower(CultureInfo.InvariantCulture).Contains(this.QueryText.ToLower(CultureInfo.InvariantCulture))
                select q;

     ObservableCollection<SampleData> data = new ObservableCollection<SampleData>();
     foreach (SampleData d in query)
     {
         data.Add(d);
      }

      this.SearchResult = data;
      this.IsSearching = false;
}

SearchResult property acts as a recipient. When this property is set, the UXSearchBox will display the search result in its dropdown menu.

Alternatively, you can also assign the search results directly to other data-aware controls, such as UXListBox or UXItemsControl.

Inheritance Hierarchy

System.Object
   System.Windows.DependencyObject
      System.Windows.UIElement
         System.Windows.FrameworkElement
            System.Windows.Controls.Control
               System.Windows.Controls.ItemsControl
                  Intersoft.Client.Framework.ISItemsControl
                     Intersoft.Client.Framework.ISSelectionControl
                        Intersoft.Client.UI.Aqua.UXCollection.UXComboBox
                           Intersoft.Client.UI.Aqua.UXCollection.UXSearchBox
                              Intersoft.Client.UI.Data.UXDataSearchBox

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2012 All Rights Reserved.