iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hi
do I have to write explicit code to handle the filtering of the UXDataComboBox, when you type in some letters for example?
At the moment my UXDataComboBox seems to hang and just show 'Searching'.
If so can you provide some code, thanks
UXDataComboBox derives from UXComboBox which means that the control is normally used to perform a single selection. It is a queryable combo box control that utilizes the power of QueryDescriptor to search records in relatively large dataset. 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.
The following code shows how to use UXDataComboBox to query and select a record.
View
<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..."/>
ViewModel
using System; using System.Collections; using Intersoft.Client.Data.ComponentModel; using Intersoft.Client.Framework.Input; 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.
Hope this helps.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname