Class HierarchyPropertyDescriptor
Represents a class that holds information of type and property name of data objects. TreeView generates the child nodes based ChildPropertyName if the type of data object matches TargetType.
Inheritance
Namespace: Syncfusion.UI.Xaml.TreeView
Assembly: Syncfusion.TreeView.WinUI.dll
Syntax
public class HierarchyPropertyDescriptor : Object
Constructors
HierarchyPropertyDescriptor()
Declaration
public HierarchyPropertyDescriptor()
Properties
ChildPropertyName
Gets or sets the property name based on that child nodes created for a node in treeview.
Declaration
public string ChildPropertyName { get; set; }
Property Value
Type | Description |
---|---|
System.String | The property name of the child. |
IsExpandedPropertyName
Gets or sets property name which is associated with expanded/collapsed state of the node.
Declaration
public string IsExpandedPropertyName { get; set; }
Property Value
Type | Description |
---|---|
System.String | The underlying property name associated with expanded/collapsed state of node. |
Remarks
This is applicable for bound mode alone. Also this will accept only boolean property, otherwise exception will be thrown.
Examples
This example demonstrates how to set IsExpandedPropertyName in both XAML.
<syncfusion:SfTreeView x:Name="treeView"
ItemsSource="{Binding Folders}">
<syncfusion:SfTreeView.HierarchyPropertyDescriptors>
<treeviewengine:HierarchyPropertyDescriptor ChildPropertyName = "Files" TargetType="local:Folder" IsExpandedPropertyName ="IsFolderOpen"/>
<treeviewengine:HierarchyPropertyDescriptor ChildPropertyName = "SubFiles" TargetType="local:File" IsExpandedPropertyName ="IsFileOpen"/>
</syncfusion:SfTreeView.HierarchyPropertyDescriptors>
</syncfusion:SfTreeView>
See Also
IsSelectedPropertyName
Gets or sets property name in data object which is associated with selection state of the node.
Declaration
public string IsSelectedPropertyName { get; set; }
Property Value
Type | Description |
---|---|
System.String | The underlying property name in data object associated with selection state of node. |
Remarks
IsSelectedPropertyName mapping with selection state of the node is applicable only when treeview populated using Syncfusion.UI.Xaml.TreeView and it not applicable when treeview populated using Nodes. Also, type of IsSelectedPropertyName property in data object should be of type bool, otherwise exception is thrown.
SelectedItems are updated based on the IsSelectedPropertyName property value in data object, only for the nodes populated. When NodePopulationMode is OnDemand, only visible nodes are populated, so SelectedItems updated only based on visible nodes and it will get further updated when the user expand the nodes further.
It is recommended to set NodePopulationMode as Instant where all level of nodes are populated in initial load itself.So, When NodePopulationMode is Instant, SelectedItems are updated based on all the nodes including nodes which are not visible.
Changing the IsSelectedPropertyName property value in data object at runtime is not supported.
Examples
This example demonstrates how to set IsSelectedPropertyName in both XAML.
<syncfusion:SfTreeView x:Name="treeView"
ItemsSource="{Binding Folders}">
<syncfusion:SfTreeView.HierarchyPropertyDescriptors>
<treeviewengine:HierarchyPropertyDescriptor ChildPropertyName = "Files"
TargetType="local:Folder"
IsSelectedPropertyName ="IsSelected"/>
<treeviewengine:HierarchyPropertyDescriptor ChildPropertyName = "SubFiles"
TargetType="local:File"
IsSelectedPropertyName ="IsSelected"/>
</syncfusion:SfTreeView.HierarchyPropertyDescriptors>
</syncfusion:SfTreeView>
See Also
TargetType
Gets or sets the type of data object bound with nodes of the Syncfusion.UI.Xaml.TreeView.
Declaration
public Type TargetType { get; set; }
Property Value
Type | Description |
---|---|
System.Type | The type of the data object bounded. |