Static TreeView Creation

Each node in the Tree is represented by a name/value pair, defined by the text and value properties of treenode, respectively. The text of a node is rendered, whereas the value of a node is not rendered and is typically used as additional data for handling postback events.

A static menu is the simplest way to create the treeview structure.

To display static C1TreeViewItems using XAML syntax, first nest opening and closing <c1:C1TreeViewItem> tags between opening and closing tags of the C1TreeView control. Next, create the treeview structure by nesting <c1:C1TreeViewItem> elements between opening and closing <Nodes> tags. Each <c1:C1TreeViewItem> element represents a node in the control and maps to a C1TreeViewItem object.

Declarative syntax can be used to define the C1TreeViewItems inline on your page.

For example:

<Grid x:Name="LayoutRoot">  

    <c1:C1TreeView x:Name="Tree">   

         <c1:C1TreeViewItem Header="Book List" IsExpanded="True" IsSelected="True">

                <c1:C1TreeViewItem Header="Language Books"/>

                <c1:C1TreeViewItem Header="Security Books"/>

                <c1:C1TreeViewItem Header="Classic Books">

                    <c1:C1TreeViewItem Header="Catch-22"/>

                    <c1:C1TreeViewItem Header="The Great Gatsby"/>

                </c1:C1TreeViewItem>

         </c1:C1TreeViewItem>

     </c1:C1TreeView>

</Grid>


Send us comments about this topic.
Copyright © GrapeCity, inc. All rights reserved.