Some examples of usage are in the documentation:
A working example is contained in the BinariesWithSimpleExamples file in the download area. Maybe examples are in aspx, instead of Razor, since the TreeView was one of the first controls implemented.
As for having all nodes closed: (x, y) => TreeViewItemStatus.Hide is OK!
About your checkboxes. The Treeview has some NATIVE checkboxes, when it is in edit mode, but they help just in selecting a new father where to drag a node. If you want your custom checkboxes for, say some selecting purposes. You need simply to furnish a template
containing a checkbox!
_S.L<EmailNotification.Models.cTreeNode>(h => h.DisplayFor(m => m.NodeName).ToString())
Is an array of templates, You may provide a couple templates (say for folder nodes and leaf nodes) or an unique template for all nodes with an in line Razor helper. See the documentation on templates:
Inside the Razor in line template you may put everything you would put in a Razor View. The HTML keyword is substituded by item, so you write something like
=>....). Add a common class, say "custom-selection" to all your checkboxes so you may recognize them...in the algorithm below.
In order to handle the click event of the checkbox, just add a click handler to any Html node that incluces the whole tree. Click events bubbles up, so you will catch all clicks of all checkboxes there.
Once you get a click or change checkbox event, extracts the event target (the original node that caused the click) and find the closest li: myTarget.closest('li'). This will be the root node of the sub-tree containing your checkbox. Now you may perform a find
to find all checkboxes of this sub-tree so you may check or uncheck them:
myTarget.closest('li').find('custom-selection') ....there you have all descendant checkboxes that you may chech or uncheck, to make they have the same statuts of the father checkbox.