Intersoft ClientUI Documentation
CanUserPage Property
See Also  Send Feedback
Intersoft.Client.UI.Data Namespace > UXDataComboBox Class : CanUserPage Property






Gets or sets a value indicating whether the search result can be paged.

Syntax

Visual Basic (Declaration) 
<CategoryAttribute("Common Properties")>
Public Property CanUserPage As Boolean
Visual Basic (Usage)Copy Code
Dim instance As UXDataComboBox
Dim value As Boolean
 
instance.CanUserPage = value
 
value = instance.CanUserPage
C# 
[CategoryAttribute("Common Properties")]
public bool CanUserPage {get; set;}
Delphi 
public read-write property CanUserPage: Boolean; 
JScript 
CategoryAttribute("Common Properties")
public function get,set CanUserPage : boolean
Managed Extensions for C++ 
[CategoryAttribute("Common Properties")]
public: __property bool get_CanUserPage();
public: __property void set_CanUserPage( 
   bool value
);
C++/CLI 
[CategoryAttribute("Common Properties")]
public:
property bool CanUserPage {
   bool get();
   void set (    bool value);
}

Example

The following code shows how to use UXPageableComboBox, which is support paging behaviour by default.

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
        }
} 

Remarks

UXPageableComboBox provides a flexible way to display a collection of data in a single or multiple columns layout. Similar to UXDataComboBox, you need to input the query into UXPageableComboBox and handle the query using the QueryDescriptor component model. The control is designed with MVVM-ready architecture so that you can write the user interaction code entirely in the ViewModel including the implementation for paging feature.

You can use the PageSize property to determine the number of item per page in your UXPageableComboBox or disable the paging feature by setting the CanUserPage property to False.

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.