Creates items for the TreeView.
Наследование: IHideObjectMembers
        public TreeViewItemFactoryTests()
        {
            ViewContext viewContext = TestHelper.CreateViewContext();

            item = new TreeViewItem();
            factory = new TreeViewItemFactory(item, viewContext);
        }
Пример #2
0
        /// <summary>
        /// Defines the items in the TreeView
        /// </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.Add().Text("Second Item");
        ///             })
        /// %&gt;
        /// </code>
        /// </example>
        public TreeViewBuilder Items(Action <TreeViewItemFactory> addAction)
        {
            Guard.IsNotNull(addAction, "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">
        ///  &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)
        {
            Guard.IsNotNull(addAction, "addAction");

            TreeViewItemFactory factory = new TreeViewItemFactory(item, viewContext);

            addAction(factory);

            return(this);
        }