/// <summary> /// Defines the items in the TreeView /// </summary> /// <param name="addAction">The add action.</param> /// <example> /// <code lang="CS"> /// <%= Html.Kendo().TreeView() /// .Name("TreeView") /// .Items(items => /// { /// items.Add().Text("First Item"); /// items.Add().Text("Second Item"); /// }) /// %> /// </code> /// </example> public TreeViewBuilder Items(Action <TreeViewItemFactory> addAction) { TreeViewItemFactory factory = new TreeViewItemFactory(Component, Component.ViewContext); addAction(factory); return(this); }
/// <summary> /// Configures the child items of a <see cref="TreeViewItem"/>. /// </summary> /// <param name="addAction">The add action.</param> /// <example> /// <code lang="CS"> /// <%= Html.Telerik().TreeView() /// .Name("TreeView") /// .Items(items => /// { /// items.Add().Text("First Item").Items(firstItemChildren => /// { /// firstItemChildren.Add().Text("Child Item 1"); /// firstItemChildren.Add().Text("Child Item 2"); /// }); /// }) /// %> /// </code> /// </example> public virtual TreeViewItemBuilder Items(Action <TreeViewItemFactory> addAction) { TreeViewItemFactory factory = new TreeViewItemFactory(item, viewContext); addAction(factory); return(this); }