Intersoft.Client.UI.Data Namespace : UXDataComboBox Class |
<TemplatePartAttribute(Name="HeadersPresenter", Type=System.Windows.Controls.Grid)> <TemplatePartAttribute(Name="NoResultTemplateElement", Type=System.Windows.Controls.Grid)> <TemplatePartAttribute(Name="NoResultTextElement", Type=System.Windows.Controls.Grid)> <TemplatePartAttribute(Name="NoResultElement", Type=System.Windows.Controls.Grid)> <TemplatePartAttribute(Name="BusyTextElement", Type=System.Windows.Controls.Grid)> <TemplatePartAttribute(Name="ItemsPresenter", Type=System.Windows.Controls.ItemsPresenter)> <TemplatePartAttribute(Name="PopupElement", Type=Intersoft.Client.UI.Controls.UXPopup)> <TemplatePartAttribute(Name="RootElement", Type=System.Windows.Controls.Grid)> <TemplatePartAttribute(Name="NonEditableElement", 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="EditableElement", Type=System.Windows.Controls.Grid)> <TemplateVisualStateAttribute(Name="HighlightFocused", GroupName="CommonStates")> <TemplateVisualStateAttribute(GroupName="FocusStates", Name="Focused")> <TemplateVisualStateAttribute(GroupName="KeyboardFocusStates", Name="KeyboardFocused")> <TemplateVisualStateAttribute(GroupName="CommonStates", Name="MouseOver")> <TemplateVisualStateAttribute(GroupName="CommonStates", Name="Pressed")> <TemplateVisualStateAttribute(GroupName="CommonStates", Name="Disabled")> <TemplateVisualStateAttribute(GroupName="ValidationStates", Name="InvalidUnfocused")> <TemplatePartAttribute(Name="ItemsContainer", Type=System.Windows.Controls.Grid)> <TemplatePartAttribute(Name="DropDownTemplateContainer", Type=System.Windows.Controls.Grid)> <TemplateVisualStateAttribute(GroupName="KeyboardFocusStates", Name="KeyboardUnfocused")> <TemplateVisualStateAttribute(GroupName="ValidationStates", Name="Valid")> <TemplateVisualStateAttribute(GroupName="CommonStates", Name="Normal")> <TemplatePartAttribute(Name="KeyboardFocus", Type=System.Windows.Shapes.Rectangle)> <TemplatePartAttribute(Name="BusyTemplateElement", Type=System.Windows.Controls.Grid)> <TemplatePartAttribute(Name="BusyElement", Type=System.Windows.Controls.Grid)> <TemplatePartAttribute(Name="MoreButtonElement", Type=System.Windows.Controls.Primitives.ButtonBase)> <DescriptionAttribute("Represents a queryable combo box control.")> <StyleTypedPropertyAttribute(Property="ScrollViewerStyle", StyleTargetType=Intersoft.Client.UI.Controls.UXScrollViewer)> <StyleTypedPropertyAttribute(Property="ItemContainerStyle", StyleTargetType=Intersoft.Client.UI.Data.UXDataComboBoxItem)> <TemplateVisualStateAttribute(GroupName="ValidationStates", Name="InvalidFocused")> <TemplateVisualStateAttribute(GroupName="FocusStates", Name="Unfocused")> <TemplatePartAttribute(Name="ClearButtonElement", Type=System.Windows.Controls.Primitives.ButtonBase)> <TemplateVisualStateAttribute(GroupName="DescriptionContainerStates", Name="DescriptionContainerVisible")> <TemplateVisualStateAttribute(GroupName="DescriptionContainerStates", Name="DescriptionContainerCollapsed")> <TemplatePartAttribute(Name="FocusVisualElement", Type=System.Windows.Controls.Border)> <TemplatePartAttribute(Name="DisabledVisualElement", Type=System.Windows.Controls.Border)> <TemplatePartAttribute(Name="StatusElement", Type=System.Windows.Controls.Grid)> <TemplatePartAttribute(Name="DescriptionTextElement", Type=System.Windows.Controls.TextBlock)> <TemplateVisualStateAttribute(GroupName="StatusBarStates", Name="StatusBarVisible")> <TemplateVisualStateAttribute(GroupName="StatusBarStates", Name="StatusBarCollapsed")> Public Class UXDataComboBox Inherits Intersoft.Client.UI.Aqua.UXCollection.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, Intersoft.Client.Framework.ISupportDataLoading
Dim instance As UXDataComboBox
[TemplatePartAttribute(Name="HeadersPresenter", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="NoResultTemplateElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="NoResultTextElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="NoResultElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="BusyTextElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="ItemsPresenter", Type=System.Windows.Controls.ItemsPresenter)] [TemplatePartAttribute(Name="PopupElement", Type=Intersoft.Client.UI.Controls.UXPopup)] [TemplatePartAttribute(Name="RootElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="NonEditableElement", 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="EditableElement", Type=System.Windows.Controls.Grid)] [TemplateVisualStateAttribute(Name="HighlightFocused", GroupName="CommonStates")] [TemplateVisualStateAttribute(GroupName="FocusStates", Name="Focused")] [TemplateVisualStateAttribute(GroupName="KeyboardFocusStates", Name="KeyboardFocused")] [TemplateVisualStateAttribute(GroupName="CommonStates", Name="MouseOver")] [TemplateVisualStateAttribute(GroupName="CommonStates", Name="Pressed")] [TemplateVisualStateAttribute(GroupName="CommonStates", Name="Disabled")] [TemplateVisualStateAttribute(GroupName="ValidationStates", Name="InvalidUnfocused")] [TemplatePartAttribute(Name="ItemsContainer", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="DropDownTemplateContainer", Type=System.Windows.Controls.Grid)] [TemplateVisualStateAttribute(GroupName="KeyboardFocusStates", Name="KeyboardUnfocused")] [TemplateVisualStateAttribute(GroupName="ValidationStates", Name="Valid")] [TemplateVisualStateAttribute(GroupName="CommonStates", Name="Normal")] [TemplatePartAttribute(Name="KeyboardFocus", Type=System.Windows.Shapes.Rectangle)] [TemplatePartAttribute(Name="BusyTemplateElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="BusyElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="MoreButtonElement", Type=System.Windows.Controls.Primitives.ButtonBase)] [DescriptionAttribute("Represents a queryable combo box control.")] [StyleTypedPropertyAttribute(Property="ScrollViewerStyle", StyleTargetType=Intersoft.Client.UI.Controls.UXScrollViewer)] [StyleTypedPropertyAttribute(Property="ItemContainerStyle", StyleTargetType=Intersoft.Client.UI.Data.UXDataComboBoxItem)] [TemplateVisualStateAttribute(GroupName="ValidationStates", Name="InvalidFocused")] [TemplateVisualStateAttribute(GroupName="FocusStates", Name="Unfocused")] [TemplatePartAttribute(Name="ClearButtonElement", Type=System.Windows.Controls.Primitives.ButtonBase)] [TemplateVisualStateAttribute(GroupName="DescriptionContainerStates", Name="DescriptionContainerVisible")] [TemplateVisualStateAttribute(GroupName="DescriptionContainerStates", Name="DescriptionContainerCollapsed")] [TemplatePartAttribute(Name="FocusVisualElement", Type=System.Windows.Controls.Border)] [TemplatePartAttribute(Name="DisabledVisualElement", Type=System.Windows.Controls.Border)] [TemplatePartAttribute(Name="StatusElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="DescriptionTextElement", Type=System.Windows.Controls.TextBlock)] [TemplateVisualStateAttribute(GroupName="StatusBarStates", Name="StatusBarVisible")] [TemplateVisualStateAttribute(GroupName="StatusBarStates", Name="StatusBarCollapsed")] public class UXDataComboBox : Intersoft.Client.UI.Aqua.UXCollection.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, Intersoft.Client.Framework.ISupportDataLoading
[TemplatePartAttribute(Name="HeadersPresenter", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="NoResultTemplateElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="NoResultTextElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="NoResultElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="BusyTextElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="ItemsPresenter", Type=System.Windows.Controls.ItemsPresenter)] [TemplatePartAttribute(Name="PopupElement", Type=Intersoft.Client.UI.Controls.UXPopup)] [TemplatePartAttribute(Name="RootElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="NonEditableElement", 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="EditableElement", Type=System.Windows.Controls.Grid)] [TemplateVisualStateAttribute(Name="HighlightFocused", GroupName="CommonStates")] [TemplateVisualStateAttribute(GroupName="FocusStates", Name="Focused")] [TemplateVisualStateAttribute(GroupName="KeyboardFocusStates", Name="KeyboardFocused")] [TemplateVisualStateAttribute(GroupName="CommonStates", Name="MouseOver")] [TemplateVisualStateAttribute(GroupName="CommonStates", Name="Pressed")] [TemplateVisualStateAttribute(GroupName="CommonStates", Name="Disabled")] [TemplateVisualStateAttribute(GroupName="ValidationStates", Name="InvalidUnfocused")] [TemplatePartAttribute(Name="ItemsContainer", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="DropDownTemplateContainer", Type=System.Windows.Controls.Grid)] [TemplateVisualStateAttribute(GroupName="KeyboardFocusStates", Name="KeyboardUnfocused")] [TemplateVisualStateAttribute(GroupName="ValidationStates", Name="Valid")] [TemplateVisualStateAttribute(GroupName="CommonStates", Name="Normal")] [TemplatePartAttribute(Name="KeyboardFocus", Type=System.Windows.Shapes.Rectangle)] [TemplatePartAttribute(Name="BusyTemplateElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="BusyElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="MoreButtonElement", Type=System.Windows.Controls.Primitives.ButtonBase)] [DescriptionAttribute("Represents a queryable combo box control.")] [StyleTypedPropertyAttribute(Property="ScrollViewerStyle", StyleTargetType=Intersoft.Client.UI.Controls.UXScrollViewer)] [StyleTypedPropertyAttribute(Property="ItemContainerStyle", StyleTargetType=Intersoft.Client.UI.Data.UXDataComboBoxItem)] [TemplateVisualStateAttribute(GroupName="ValidationStates", Name="InvalidFocused")] [TemplateVisualStateAttribute(GroupName="FocusStates", Name="Unfocused")] [TemplatePartAttribute(Name="ClearButtonElement", Type=System.Windows.Controls.Primitives.ButtonBase)] [TemplateVisualStateAttribute(GroupName="DescriptionContainerStates", Name="DescriptionContainerVisible")] [TemplateVisualStateAttribute(GroupName="DescriptionContainerStates", Name="DescriptionContainerCollapsed")] [TemplatePartAttribute(Name="FocusVisualElement", Type=System.Windows.Controls.Border)] [TemplatePartAttribute(Name="DisabledVisualElement", Type=System.Windows.Controls.Border)] [TemplatePartAttribute(Name="StatusElement", Type=System.Windows.Controls.Grid)] [TemplatePartAttribute(Name="DescriptionTextElement", Type=System.Windows.Controls.TextBlock)] [TemplateVisualStateAttribute(GroupName="StatusBarStates", Name="StatusBarVisible")] [TemplateVisualStateAttribute(GroupName="StatusBarStates", Name="StatusBarCollapsed")] public ref class UXDataComboBox : public Intersoft.Client.UI.Aqua.UXCollection.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, Intersoft.Client.Framework.ISupportDataLoading
UXDataComboBox is used to query and select a record from relatively large data set. Unlike UXComboBox, UXDataComboBox does not have a collection of items bound initially. You need to input the query to UXDataComboBox and handle the query using the QueryDescriptor and MVVM pattern. To learn more about the QueryDescriptor, see Query Descriptor Overview. For more information about MVVM pattern, see MVVM Pattern Overview.
To learn more about UXDataComboBox see UXDataComboBox Overview.
The following code shows how to use UXDataComboBox to query and select a record.
View |
Copy Code
|
---|---|
<Intersoft:UXDataComboBox x:Name="SampleControl1" DisplayMemberPath="FirstName" Width="150" SelectedValue="{Binding LeaveRequest.EmployeeID, Mode=TwoWay}" SelectedValuePath="EmployeeID" SearchResult="{Binding Employees}" FilterDescriptors="{Binding LookUpDescriptor.FilterDescriptors, Mode=TwoWay}" BusyMode="Always" AutoShowResultBox="True" IsTextSearchEnabled="True" ToolTipService.ToolTip="Try to type in 'a', 'r', or 's' character..."/> |
ViewMoel |
Copy Code
|
---|---|
using System; using System.Collections; using Intersoft.Client.Data.ComponentModel; using Intersoft.ClientUI.Samples.DataControls.ModelServices; namespace Intersoft.ClientUI.Samples.DataControls.ViewModels { public class DataComboBoxViewModel : ViewModelBase { #region Constructors public DataComboBoxViewModel() { if (!this.IsInDesignMode) { this.EmployeesSource = EmployeesRepository.Instance; this.Presenter = new MessagePresenter(); this.LookUpDescriptor = new QueryDescriptor(); } } #endregion #region Fields private IEnumerable _employees; private QueryDescriptor _lookUpDescriptor; #endregion #region Properties public IEnumerable Employees { get { return this._employees; } set { if (_employees != value) { _employees = value; OnPropertyChanged("Employees"); } } } protected IDataRepository EmployeesSource { get; set; } protected bool IsInDesignMode { get { return Intersoft.Client.Framework.ISControl.IsInDesignModeStatic; } } public QueryDescriptor LookUpDescriptor { get { return _lookUpDescriptor; } set { if (_lookUpDescriptor != value) { if (_lookUpDescriptor != null) _lookUpDescriptor.QueryChanged -= new EventHandler(OnLookUpQueryChanged); _lookUpDescriptor = value; _lookUpDescriptor.QueryChanged += new EventHandler(OnLookUpQueryChanged); OnPropertyChanged("LookUpDescriptor"); } } } protected virtual MessagePresenter Presenter { get; private set; } #endregion #region Methods private void OnLookUpQueryChanged(object sender, EventArgs e) { this.EmployeesSource.GetData ( this.LookUpDescriptor, (employees) => { this.Employees = employees; }, (totalItemCount) => { }, (error) => { this.Presenter.ShowErrorMessage( "An exception has occurred during data loading\n." + "Message: " + error.Message + "Stack Trace: " + error.StackTrace); } ); } #endregion } } |
Notice that you only need to bind the FilterDescriptors in your XAML and handle the QueryChanged in your ViewModel. The UXDataComboBox will pass the filter descriptors based on FilterMemberPath, FilterOperator and user's input query.
If the FilterMemberPath property is not specified, UXDataComboBox will use DisplayMemberPath for the filtering purpose. |
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.Data.UXDataComboBox
Intersoft.Client.UI.Data.UXDataLookupBox
Intersoft.Client.UI.Data.UXMultipleSelectionComboBox
Intersoft.Client.UI.Data.UXPageableComboBox
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