﻿<?xml version="1.0" encoding="utf-8"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - ClientUI - UXDataComboBox question</title><link>http://www.intersoftsolutions.com/Community/ClientUI/UXDataComboBox-question/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>UXDataComboBox question</title><link>http://www.intersoftsolutions.com/Community/ClientUI/UXDataComboBox-question/</link><pubDate>Tue, 17 Apr 2012 22:31:18 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt;"&gt;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.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt;"&gt;The following code shows how to use UXDataComboBox to query and select a record.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt;"&gt;View&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;&amp;lt;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..."/&amp;gt;&lt;/pre&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt;"&gt;ViewModel&lt;/span&gt;&lt;/p&gt;
&lt;pre&gt;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) =&amp;gt;
                {
                    this.Employees = employees;
                },
                (totalItemCount) =&amp;gt;
                {
                },
                (error) =&amp;gt;
                {
                    this.Presenter.ShowErrorMessage(
                        "An exception has occurred during data loading\n." +
                        "Message: " + error.Message +
                        "Stack Trace: " + error.StackTrace);
                }
            );
        }

        #endregion
    }
}&lt;/pre&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt;"&gt;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.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: 'segoe ui','sans-serif'; color: #1f497d; font-size: 9pt;"&gt;Hope this helps.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>UXDataComboBox question</title><link>http://www.intersoftsolutions.com/Community/ClientUI/UXDataComboBox-question/</link><pubDate>Tue, 17 Apr 2012 06:13:10 GMT</pubDate><dc:creator>zen8019</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;&lt;p&gt;do I have to write explicit code to handle the filtering of the UXDataComboBox, when you type in some letters for example?&lt;/p&gt;
&lt;p&gt;At the moment my UXDataComboBox seems to hang and just show 'Searching'.&lt;/p&gt;
&lt;p&gt;If so can you provide some code, thanks&lt;/p&gt;</description></item></channel></rss>