Intersoft.Client.UI.Data Namespace > UXTreeList Class : IDBinding Property |
Public Property IDBinding As Binding
Dim instance As UXTreeList Dim value As Binding instance.IDBinding = value value = instance.IDBinding
public Binding IDBinding {get; set;}
UXTreeList derives from UXGridView which represents a data grid control. This means that it shares all the innovative feature from UXGridView. To learn more about UXGridView, see UXGridView Overview.
To bind data to UXTreeList, you need to set the ItemsSource property with an object of type HierarchicalCollectionView and set the ParentIDBinding and IDBinding properties in UXTreeList to appropriate the column in your data source.
The HierarchicalCollectionView expects linear data source similar to how you store the data in a relational database where you have the ID as primary key and ParentID as the foreign key.
The following is an example of data source accepted by HierarchicalCollectionView.
EmployeeID | Last Name | First Name | Title | Date of Birth | Reports To |
---|---|---|---|---|---|
1 | Davolio | Nancy | Sales Representative | 12/8/1948 | 2 |
2 | Fuller | Andrew | Vice President, Sales | 2/9/1952 | NULL |
3 | Leverling | Janet | Sales Representative | 8/30/1963 | 2 |
4 | Peacock | Margaret | Sales Representative | 9/19/1937 | 2 |
5 | Buchanan | Steve | Sales Manager | 3/4/1955 | 2 |
6 | Suyama | Michael | Sales Representative | 7/2/1963 | 5 |
7 | King | Robert | Sales Representative | 5/29/1960 | 5 |
8 | Callahan | Laura | Inside Sales Coordinator | 1/9/1958 | 5 |
9 | Dodsworth | Anne | Sales Representative | 1/27/1966 | 2 |
The following code shows how to implement a simple UXTreeList with data binding in XAML.
XAML |
Copy Code
|
---|---|
<Intersoft:UXTreeList ItemsSource="{Binding Items}" ParentIDBinding="{Binding ReportsTo}" IDBinding="{Binding EmployeeID}"/> |
C# |
Copy Code
|
---|---|
this.Items = new HierarchicalCollectionView(new ObservableCollection<Employee>(items.Cast<Employee>())); |
Similar to UXGridView, you can view or interact with information in UXTreeList by performing grouping, sorting and filtering. However, paging is not supported due to the nature of the tree list control.
To handle this data operation UXTreeList provides two approaches that you can choose from by setting the QueryOperation property.
Client data operation means that the data operation, such as sorting, and filtering; are executed in the client side against the data source provided to the UXTreeList. To use this operation, you set the QueryOperation property to Client.
It's highly recommended to use the Client data operation for the best user experiences, such as automatic persistence of the expanded state.
Server data operation means that the data operation, such as sorting, and filtering; are processed in the server side. In this mode, UXTreeList does not handle the data operation by its own. It will simply provide the query information allowing you to process it further to a data service.
To use this mode, you set the QueryOperation property to Server. When this mode is selected, UXTreeList will not attempt to perform the data operation on the given data source. Instead, it will store and distribute the query information on several properties such as FilterDescriptors, SortDescriptors and PageDescriptor property. When one of these properties change, the QueryChanged event of the associated QueryDescriptor will be raised. This allows you to streamline the query processing in a centralized function, which is one of the strong benefits of QueryDescriptor. For more information about QueryDescriptor, see QueryDescriptor Overview
Using this approach the ItemsSource will always be updated every time perform a data operation which will reset all the expanded state to the original states determined by InitialTreeListState.
It is recommended to load all the data first and use the QueryOperation = Client for better user experiences. You can opted to use the QueryOperation = Server when the data is relatively large and you always play around with filtering since paging is not supported in UXTreeList. |
The benefit of doing client data operation in UXTreeList is that all the expanded state of each item will be persisted. This applies to all client data operations such as sorting, filtering and grouping.
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