KetticTreeView Data Binding to Objects in C#.NET
KetticTreeView control for Windows Forms provides powerful data binding capability and the developers can just configure a simple property of the control to bind the TreeView to any data sources or object that implements IList, IListSource, IBindingList, generic lists, and BindingSource, in your Window Forms development environment. The business objects data binding of KetticTreeView is achieved by using the DataSource property of this tree view component. The following C# tutorial demonstrates how to bind the TreeView to objects
Properties for Binding KetticTreeView to Data Objects
C# Binding KetticTreeView to Generic List in Windows Forms
In the C# code snippet sample below, we are going to bind the KetticTreeView to a generic list of an object to display only one data level. This generic list object contains three fields, an integer, a char, and a string. We shall assign the ValueMember property to the int field and assign the ShowMember to the string field. C# Getting Object Bound to Data for Node in KetticTreeView
After we bind the KetticTreeView to generic list object, we can also to get the data from the object. The following C# code example demonstrates how to get the price of a Student as we selecting node of the Student. The price message will be shown in the message box when we choose a node.
In addition, when we initially set an item bound data to the KetticTreeNode, it will fire the NodeDataBound event, which can help you to sync the properties of KetticTreeNode with those of the data bound item. The C# code below shows the process.
C# Data Binding to Show Hierarchical data in KetticTreeView
This is the highlight feature of the KetticTreeView control for WinForms. The developers can bind this control to the hierarchical data and display the hierarchy of custom object. The following C# code sample will contains a Grade parent level, in which the Grade will contains various Classes and has the only Grade Name property and a list of classes. To show the hierarchy of business objects, we shall assign appropriate values to the ShowMember and ChildMember properties. | ![]() UI Controlsfor Windows Forms .NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI DesignWinForms UI Controls WinForms Buttons UI Control WinForms Calendar UI ControlWinForms Carousel UI ControlWinForms Chart UI ControlWinForms Clock UI ControlCommandBar UI ControlWinForms Dock UI ControlDesktop Alert UI ControlDropDown List UI ControlWinForms Editor UI ControlForms and Dialogs UI ControlWinForms GridView UI ControlWinForms ListView UI ControlWinForms Menu UI ControlWinForms ComboBox UI ControlWinForms PageView UI ControlPanels and Labels UI ControlWinForms Panorama UI ControlWinForms PDFViewer UI ControlWinForms Property Grid UI ControlWinForms Ribbon UI ControlWinForms PivotGrid UI ControlWinForms RichTextBox UI ControlWinForms Rotator UI ControlWinForms Scheduler UI ControlWinForms Shortcuts UI ControlWinForms SpellChecker UI ControlWinForms Track & Status UI ControlWinForms TreeView UI ControlKeyboard SupportDesign Time SupportBuild PropertyContext MenuTreeView - NodeAdd & Remove NodesReorder NodesFormat NodesEdit NodesSelect NodesFilter NodesCustom Filter NodesSort NodesCustom Sort NodesFind Sort NodesData BindingBasicsDatabaseXML DataDrag and DropCustomizationContext MenuCustomizationAssign ScreenTipLocalizationWinForms Wizard UI ControlWinForms Test UI ControlWinForms Theme UI Control |