Intersoft.Client.UI.Aqua.UXCollection Namespace : UXSearchBox Class |
<TemplatePartAttribute(Name="PopupElement", Type=Intersoft.Client.UI.Controls.UXPopup)> <StyleTypedPropertyAttribute(Property="ScrollViewerStyle", StyleTargetType=Intersoft.Client.UI.Controls.UXScrollViewer)> <StyleTypedPropertyAttribute(Property="ItemContainerStyle", StyleTargetType=Intersoft.Client.UI.Aqua.UXCollection.UXSearchBoxItem)> <TemplateVisualStateAttribute(Name="KeyboardFocused", GroupName="KeyboardFocusStates")> <TemplateVisualStateAttribute(GroupName="CommonStates", Name="HighlightFocused")> <TemplatePartAttribute(Name="ScrollElement", Type=Intersoft.Client.UI.Controls.UXScrollViewer)> <TemplateVisualStateAttribute(GroupName="FocusStates", Name="Unfocused")> <TemplateVisualStateAttribute(GroupName="CommonStates", Name="Normal")> <TemplatePartAttribute(Name="FocusVisualElement", Type=System.Windows.Controls.Border)> <TemplatePartAttribute(Name="KeyboardFocus", Type=System.Windows.Shapes.Rectangle)> <TemplatePartAttribute(Name="RootElement", Type=System.Windows.Controls.Grid)> <TemplatePartAttribute(Name="DisabledVisualElement", Type=System.Windows.Controls.Border)> <TemplatePartAttribute(Name="EditableElement", Type=System.Windows.Controls.Grid)> <TemplateVisualStateAttribute(GroupName="FocusStates", Name="Focused")> <TemplateVisualStateAttribute(GroupName="KeyboardFocusStates", Name="KeyboardUnfocused")> <TemplateVisualStateAttribute(GroupName="CommonStates", Name="Disabled")> <TemplatePartAttribute(Name="BusyTemplateElement", Type=System.Windows.Controls.Grid)> <TemplatePartAttribute(Name="BusyElement", Type=System.Windows.Controls.Grid)> <TemplatePartAttribute(Name="NoResultElement", Type=System.Windows.Controls.Grid)> <TemplatePartAttribute(Name="BusyTextElement", Type=System.Windows.Controls.Grid)> <TemplatePartAttribute(Name="NonEditableElement", Type=System.Windows.Controls.Grid)> <TemplatePartAttribute(Name="ItemsContainer", Type=System.Windows.Controls.Grid)> <TemplatePartAttribute(Name="DropDownButton", Type=Intersoft.Client.UI.Aqua.UXToggleButton)> <TemplatePartAttribute(Name="InputElement", Type=Intersoft.Client.UI.Controls.UXTextBox)> <TemplatePartAttribute(Name="ItemsPresenter", Type=System.Windows.Controls.ItemsPresenter)> <DescriptionAttribute("Represents a search box control with built-in dropdown and search button.")> <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)> <TemplatePartAttribute(Name="DropDownTemplateContainer", Type=System.Windows.Controls.Grid)> <TemplatePartAttribute(Name="ResetButton", Type=Intersoft.Client.UI.Aqua.UXButton)> Public Class UXSearchBox Inherits UXComboBox Implements Intersoft.Client.Framework.IControl, Intersoft.Client.Framework.IFramework, Intersoft.Client.Framework.IItemsControl, Intersoft.Client.Framework.ILicensing, Intersoft.Client.Framework.Input.IFocusRedirection, Intersoft.Client.Framework.Input.IKeyboardFocus, Intersoft.Client.Framework.ISelection
Dim instance As UXSearchBox
[TemplatePartAttribute(Name="PopupElement", Type=Intersoft.Client.UI.Controls.UXPopup)] [StyleTypedPropertyAttribute(Property="ScrollViewerStyle", StyleTargetType=Intersoft.Client.UI.Controls.UXScrollViewer)] [StyleTypedPropertyAttribute(Property="ItemContainerStyle", StyleTargetType=Intersoft.Client.UI.Aqua.UXCollection.UXSearchBoxItem)] [TemplateVisualStateAttribute(Name="KeyboardFocused", GroupName="KeyboardFocusStates")] [TemplateVisualStateAttribute(GroupName="CommonStates", Name="HighlightFocused")] [TemplatePartAttribute(Name="ScrollElement", Type=Intersoft.Client.UI.Controls.UXScrollViewer)] [TemplateVisualStateAttribute(GroupName="FocusStates", Name="Unfocused")] [TemplateVisualStateAttribute(GroupName="CommonStates", Name="Normal")] [TemplatePartAttribute(Name="FocusVisualElement", Type=System.Windows.Controls.Border)] [TemplatePartAttribute(Name="KeyboardFocus", Type=System.Windows.Shapes.Rectangle)] [TemplatePartAttribute(Name="RootElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="DisabledVisualElement", Type=System.Windows.Controls.Border)] [TemplatePartAttribute(Name="EditableElement", Type=System.Windows.Controls.Grid)] [TemplateVisualStateAttribute(GroupName="FocusStates", Name="Focused")] [TemplateVisualStateAttribute(GroupName="KeyboardFocusStates", Name="KeyboardUnfocused")] [TemplateVisualStateAttribute(GroupName="CommonStates", Name="Disabled")] [TemplatePartAttribute(Name="BusyTemplateElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="BusyElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="NoResultElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="BusyTextElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="NonEditableElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="ItemsContainer", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="DropDownButton", Type=Intersoft.Client.UI.Aqua.UXToggleButton)] [TemplatePartAttribute(Name="InputElement", Type=Intersoft.Client.UI.Controls.UXTextBox)] [TemplatePartAttribute(Name="ItemsPresenter", Type=System.Windows.Controls.ItemsPresenter)] [DescriptionAttribute("Represents a search box control with built-in dropdown and search button.")] [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)] [TemplatePartAttribute(Name="DropDownTemplateContainer", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="ResetButton", Type=Intersoft.Client.UI.Aqua.UXButton)] public class UXSearchBox : UXComboBox, Intersoft.Client.Framework.IControl, Intersoft.Client.Framework.IFramework, Intersoft.Client.Framework.IItemsControl, Intersoft.Client.Framework.ILicensing, Intersoft.Client.Framework.Input.IFocusRedirection, Intersoft.Client.Framework.Input.IKeyboardFocus, Intersoft.Client.Framework.ISelection
[TemplatePartAttribute(Name="PopupElement", Type=Intersoft.Client.UI.Controls.UXPopup)] [StyleTypedPropertyAttribute(Property="ScrollViewerStyle", StyleTargetType=Intersoft.Client.UI.Controls.UXScrollViewer)] [StyleTypedPropertyAttribute(Property="ItemContainerStyle", StyleTargetType=Intersoft.Client.UI.Aqua.UXCollection.UXSearchBoxItem)] [TemplateVisualStateAttribute(Name="KeyboardFocused", GroupName="KeyboardFocusStates")] [TemplateVisualStateAttribute(GroupName="CommonStates", Name="HighlightFocused")] [TemplatePartAttribute(Name="ScrollElement", Type=Intersoft.Client.UI.Controls.UXScrollViewer)] [TemplateVisualStateAttribute(GroupName="FocusStates", Name="Unfocused")] [TemplateVisualStateAttribute(GroupName="CommonStates", Name="Normal")] [TemplatePartAttribute(Name="FocusVisualElement", Type=System.Windows.Controls.Border)] [TemplatePartAttribute(Name="KeyboardFocus", Type=System.Windows.Shapes.Rectangle)] [TemplatePartAttribute(Name="RootElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="DisabledVisualElement", Type=System.Windows.Controls.Border)] [TemplatePartAttribute(Name="EditableElement", Type=System.Windows.Controls.Grid)] [TemplateVisualStateAttribute(GroupName="FocusStates", Name="Focused")] [TemplateVisualStateAttribute(GroupName="KeyboardFocusStates", Name="KeyboardUnfocused")] [TemplateVisualStateAttribute(GroupName="CommonStates", Name="Disabled")] [TemplatePartAttribute(Name="BusyTemplateElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="BusyElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="NoResultElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="BusyTextElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="NonEditableElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="ItemsContainer", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="DropDownButton", Type=Intersoft.Client.UI.Aqua.UXToggleButton)] [TemplatePartAttribute(Name="InputElement", Type=Intersoft.Client.UI.Controls.UXTextBox)] [TemplatePartAttribute(Name="ItemsPresenter", Type=System.Windows.Controls.ItemsPresenter)] [DescriptionAttribute("Represents a search box control with built-in dropdown and search button.")] [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)] [TemplatePartAttribute(Name="DropDownTemplateContainer", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="ResetButton", Type=Intersoft.Client.UI.Aqua.UXButton)] public ref class UXSearchBox : public UXComboBox, Intersoft.Client.Framework.IControl, Intersoft.Client.Framework.IFramework, Intersoft.Client.Framework.IItemsControl, Intersoft.Client.Framework.ILicensing, Intersoft.Client.Framework.Input.IFocusRedirection, Intersoft.Client.Framework.Input.IKeyboardFocus, Intersoft.Client.Framework.ISelection
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.
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
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2