Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions wpf/TreeView/Checkbox.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ sfTreeView.CheckedItems.Add(viewModel.Items[3]);
{% endhighlight %}
{% endtabs %}

N> Set [NodePopulationMode](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeView.SfTreeView.html#Syncfusion_UI_Xaml_TreeView_SfTreeView_NodePopulationMode) as `Instant` when programmatically adding items to the [CheckedItems](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeView.SfTreeView.html#Syncfusion_UI_Xaml_TreeView_SfTreeView_CheckedItems) to enable the `Recursive` checkbox mode.

## Events

### NodeChecked event
Expand Down
6 changes: 6 additions & 0 deletions wpf/TreeView/Data-Population.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,17 @@ To update the collection changes in UI, it is necessary to define [NotificationS
* None - It is a default mode and it doesn’t reflect collection/property changes in UI.
To decide how to populate the nodes, it is necessary to set this `NodePopulationMode` API to Treeview.

### NodePopulationMode

The [NodePopulationMode](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeView.SfTreeView.html#Syncfusion_UI_Xaml_TreeView_SfTreeView_NodePopulationMode) API has following enum values:

* OnDemand - Populate the child nodes only when parent nodes is expanded. It is the default value.
* Instant - Populates all the child nodes when Treeview control is initially loaded.

### Limitations when CheckBoxMode is Recursive

When [CheckBoxMode](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeView.SfTreeView.html#Syncfusion_UI_Xaml_TreeView_SfTreeView_CheckBoxMode) is set to `Recursive` and [NodePopulationMode](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeView.SfTreeView.html#Syncfusion_UI_Xaml_TreeView_SfTreeView_NodePopulationMode) is set to `OnDemand` (default), programmatically adding items to the [CheckedItems](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeView.SfTreeView.html#Syncfusion_UI_Xaml_TreeView_SfTreeView_CheckedItems) collection will not correctly update parent checkbox states (tri-state: intermediate/checked/unchecked). This is because child nodes are not created until parent nodes are expanded, so the control cannot locate the [TreeViewNode](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.TreeView.Engine.TreeViewNode.html) to propagate the checkbox state. To use recursive checkbox propagation correctly, `NodePopulationMode` must be set to `Instant`.

### Create Data Model for treeview

Create a simple data source as shown in the following code example in a new class file, and save it as FileManager.cs file:
Expand Down