예제 #1
0
        /// <summary>
        /// Defines the items in the TreeView
        /// </summary>
        /// <param name="addAction">The add action.</param>
        /// <example>
        /// <code lang="CS">
        ///  &lt;%= Html.Kendo().TreeView()
        ///             .Name("TreeView")
        ///             .Items(items =>
        ///             {
        ///                 items.Add().Text("First Item");
        ///                 items.Add().Text("Second Item");
        ///             })
        /// %&gt;
        /// </code>
        /// </example>
        public TreeViewBuilder Items(Action <TreeViewItemFactory> addAction)
        {
            TreeViewItemFactory factory = new TreeViewItemFactory(Component, Component.ViewContext);

            addAction(factory);

            return(this);
        }
예제 #2
0
        /// <summary>
        /// Configures the child items of a <see cref="TreeViewItem"/>.
        /// </summary>
        /// <param name="addAction">The add action.</param>
        /// <example>
        /// <code lang="CS">
        ///  &lt;%= 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");
        ///                 });
        ///             })
        /// %&gt;
        /// </code>
        /// </example>
        public virtual TreeViewItemBuilder Items(Action <TreeViewItemFactory> addAction)
        {
            TreeViewItemFactory factory = new TreeViewItemFactory(item, viewContext);

            addAction(factory);

            return(this);
        }