Intersoft ClientUI Documentation
UXPageableComboBox Class
Members  See Also  Send Feedback
Intersoft.Client.UI.Data Namespace : UXPageableComboBox Class






Object Model

UXPageableComboBox Class

Syntax

Visual Basic (Declaration) 
Public Class UXPageableComboBox 
   Inherits UXDataComboBox
   Implements IControlIFramework, ILicensing, IFocusRedirectionIKeyboardFocusISelection 
Visual Basic (Usage)Copy Code
Dim instance As UXPageableComboBox
C# 
public class UXPageableComboBox : UXDataComboBox, IControlIFramework, ILicensing, IFocusRedirectionIKeyboardFocusISelection  
Delphi 
public class UXPageableComboBox = class(UXDataComboBox, IControl, IFramework, ILicensing, IFocusRedirection, IKeyboardFocus, ISelection)
JScript 
public class UXPageableComboBox extends UXDataComboBox implements IControlIFramework, ILicensing, IFocusRedirectionIKeyboardFocusISelection 
Managed Extensions for C++ 
public __gc class UXPageableComboBox : public UXDataComboBox, IControlIFramework, ILicensing, IFocusRedirectionIKeyboardFocusISelection  
C++/CLI 
public ref class UXPageableComboBox : public UXDataComboBox, IControlIFramework, ILicensing, IFocusRedirectionIKeyboardFocusISelection  

Example

The following code shows how to use UXPageableComboBox to query and display the records in single column layout.

XAML Copy Code
<Intersoft:UXPageableComboBox SearchResult="{Binding Customers}"
        FilterDescriptors="{Binding LookUpDescriptor.FilterDescriptors, Mode=TwoWay}"
        SortDescriptors="{Binding LookUpDescriptor.SortDescriptors, Mode=TwoWay}" 
        PageDescriptor="{Binding LookUpDescriptor.PageDescriptor}"
        DisplayMemberPath="ContactName"
        StatusBarVisibility="True">        
        <Intersoft:UXPageableComboBox.DataContext>
                <ViewModels:CustomerViewModel/>
        </Intersoft:UXPageableComboBox.DataContext>                       
</Intersoft:UXPageableComboBox>
C# 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 CustomerViewModel : ViewModelBase
        {
                #region Constructors

                public CustomerViewModel()
                {
                        this.CustomersSource = CustomersRepository.Instance;
                        this.Presenter = new MessagePresenter();
                        this.LookUpDescriptor = new QueryDescriptor();
                        
                        // Initialize Sort Descriptor
                        this.LookUpDescriptor.SuspendQueryChanged = true;
                        this.LookUpDescriptor.SortDescriptors.Add(new SortDescriptor() { PropertyName = "ContactName", Direction = ListSortDirection.Ascending });
                        this.LookUpDescriptor.SuspendQueryChanged = false;
                }
                
                #endregion
                
                #region Fields

                private IEnumerable _customers;
                private QueryDescriptor _lookUpDescriptor;
                
                #endregion
                
                #region Properties

                protected IDataRepository CustomersSource { get; set; }

                public IEnumerable Customers
                {
                        get { return this._customers; }
                        set
                        {
                                if (_customers != value)
                                {
                                        _customers = value;
                                        OnPropertyChanged("Customers");
                                }
                        }
                }

                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.CustomersSource.GetData
                        (
                                this.LookUpDescriptor,
                                (customers) =>
                                {
                                        if (this.LookUpDescriptor.PageDescriptor.PageIndex > 0)
                                        {
                                                ObservableCollection<object> items = this.Customers as ObservableCollection<object>;
                                                foreach (var customer in customers)
                                                {
                                                        items.Add(customer);
                                                }
                                        }
                                        else
                                        {
                                                ObservableCollection<object> items = new ObservableCollection<object>(customers.Cast<object>());
                                                this.Customers = items;
                                        }
                                },
                                (totalItemCount) =>
                                {
                                        if (totalItemCount != -1)
                                                this.LookUpDescriptor.PageDescriptor.TotalItemCount = totalItemCount;
                                },
                                (error) =>
                                {
                                        this.Presenter.ShowErrorMessage(
                                                "An exception has occurred during data loading\n." +
                                                "Message: " + error.Message +
                                                "Stack Trace: " + error.StackTrace);
                                }
                        );
                }
                
                #endregion
        }
} 

As seen in the example above, notice that you only need to bind the FilterDescriptors in the XAML and handle the QueryChanged in your ViewModel. UXPageableComboBox will automatically provide the filter descriptors based on FilterMemberPath, FilterOperator and user's input query.

When the PageDescriptor is larger than 0, this indicates that the control is requesting more data to be retrieved. As seen in the code above, you should add the new items to the existing collection instead of assigning the result to the initial collection property. This approach allows incremental data loading which significantly improves performance even for very large data scenario.

If the FilterMemberPath property is not specified, UXDataComboBox will use DisplayMemberPath for the filtering purpose.

Remarks

UXPageableComboBox is an enhanced UXDataComboBox control featuring highly-efficient data retrieval mechanism through server paging and sorting capabilities. In addition, it also includes a host of innovative features such as multiple columns, templated column, description text, and much more.

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.Data.UXDataComboBox
                              Intersoft.Client.UI.Data.UXPageableComboBox

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.