|
| 1 | +# TreeView |
| 2 | + |
| 3 | +The TreeView component is meant to emulate the asp:TreeView control in markup and is defined in the [System.Web.UI.WebControls.TreeView class](https://docs.microsoft.com/en-us/dotnet/api/system.web.ui.webcontrols.treeview?view=netframework-4.8) |
| 4 | + |
| 5 | +[Usage Notes](#usage-notes) | [Web Forms Syntax](#web-forms-declarative-syntax) | [Blazor Syntax](#blazor-syntax) |
| 6 | + |
| 7 | +## Features supported in Blazor |
| 8 | + |
| 9 | +- Static Tree Nodes |
| 10 | +- Checkbox display |
| 11 | +- TreeNode expand and collapse events |
| 12 | +- TreeNode checkbox checked / unchecked events |
| 13 | +- XmlDocument databinding |
| 14 | + |
| 15 | +##### [Back to top](#treeview) |
| 16 | + |
| 17 | +## Usage Notes |
| 18 | + |
| 19 | +- ShowCheckBoxes attribute, when specifying multiple values, should be separated by a vertical pipe `|` instead of commas |
| 20 | + |
| 21 | +##### [Back to top](#treeview) |
| 22 | + |
| 23 | +## Web Forms Declarative Syntax |
| 24 | + |
| 25 | +```html |
| 26 | +<asp:TreeView |
| 27 | + AccessKey="string" |
| 28 | + AutoGenerateDataBindings="True|False" |
| 29 | + BackColor="color name|#dddddd" |
| 30 | + BorderColor="color name|#dddddd" |
| 31 | + BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double|Groove|Ridge| |
| 32 | + Inset|Outset" |
| 33 | + BorderWidth="size" |
| 34 | + CollapseImageToolTip="string" |
| 35 | + CollapseImageUrl="uri" |
| 36 | + CssClass="string" |
| 37 | + DataSource="string" |
| 38 | + DataSourceID="string" |
| 39 | + EnableClientScript="True|False" |
| 40 | + Enabled="True|False" |
| 41 | + EnableTheming="True|False" |
| 42 | + EnableViewState="True|False" |
| 43 | + ExpandDepth="string|FullyExpand|0|1|2|3|4|5|6|7|8|9|10|11|12|13| |
| 44 | + 14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30" |
| 45 | + ExpandImageToolTip="string" |
| 46 | + ExpandImageUrl="uri" |
| 47 | + Font-Bold="True|False" |
| 48 | + Font-Italic="True|False" |
| 49 | + Font-Names="string" |
| 50 | + Font-Overline="True|False" |
| 51 | + Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small|Medium| |
| 52 | + Large|X-Large|XX-Large" |
| 53 | + Font-Strikeout="True|False" |
| 54 | + Font-Underline="True|False" |
| 55 | + ForeColor="color name|#dddddd" |
| 56 | + Height="size" |
| 57 | + ID="string" |
| 58 | + ImageSet="Custom|XPFileExplorer|Msdn|WindowsHelp|Simple|Simple2| |
| 59 | + BulletedList|BulletedList2|BulletedList3|BulletedList4| |
| 60 | + Arrows|News|Contacts|Inbox|Events|Faq" |
| 61 | + LineImagesFolder="string" |
| 62 | + MaxDataBindDepth="integer" |
| 63 | + NodeIndent="integer" |
| 64 | + NodeWrap="True|False" |
| 65 | + NoExpandImageUrl="uri" |
| 66 | + OnDataBinding="DataBinding event handler" |
| 67 | + OnDataBound="DataBound event handler" |
| 68 | + OnDisposed="Disposed event handler" |
| 69 | + OnInit="Init event handler" |
| 70 | + OnLoad="Load event handler" |
| 71 | + OnPreRender="PreRender event handler" |
| 72 | + OnSelectedNodeChanged="SelectedNodeChanged event handler" |
| 73 | + OnTreeNodeCheckChanged="TreeNodeCheckChanged event handler" |
| 74 | + OnTreeNodeCollapsed="TreeNodeCollapsed event handler" |
| 75 | + OnTreeNodeDataBound="TreeNodeDataBound event handler" |
| 76 | + OnTreeNodeExpanded="TreeNodeExpanded event handler" |
| 77 | + OnTreeNodePopulate="TreeNodePopulate event handler" |
| 78 | + OnUnload="Unload event handler" |
| 79 | + PathSeparator="string" |
| 80 | + PopulateNodesFromClient="True|False" |
| 81 | + runat="server" |
| 82 | + ShowCheckBoxes="None|Root|Parent|Leaf|All" |
| 83 | + ShowExpandCollapse="True|False" |
| 84 | + ShowLines="True|False" |
| 85 | + SkinID="string" |
| 86 | + SkipLinkText="string" |
| 87 | + Style="string" |
| 88 | + TabIndex="integer" |
| 89 | + Target="string" |
| 90 | + ToolTip="string" |
| 91 | + Visible="True|False" |
| 92 | + Width="size" |
| 93 | +> |
| 94 | + <DataBindings> |
| 95 | + <asp:TreeNodeBinding |
| 96 | + DataMember="string" |
| 97 | + Depth="integer" |
| 98 | + FormatString="string" |
| 99 | + ImageToolTip="string" |
| 100 | + ImageToolTipField="string" |
| 101 | + ImageUrl="uri" |
| 102 | + ImageUrlField="string" |
| 103 | + NavigateUrl="uri" |
| 104 | + NavigateUrlField="string" |
| 105 | + PopulateOnDemand="True|False" |
| 106 | + SelectAction="Select|Expand|SelectExpand|None" |
| 107 | + ShowCheckBox="string" |
| 108 | + Target="string" |
| 109 | + TargetField="string" |
| 110 | + Text="string" |
| 111 | + TextField="string" |
| 112 | + ToolTip="string" |
| 113 | + ToolTipField="string" |
| 114 | + Value="string" |
| 115 | + ValueField="string" |
| 116 | + /> |
| 117 | + </DataBindings> |
| 118 | + <HoverNodeStyle /> |
| 119 | + <LeafNodeStyle |
| 120 | + BackColor="color name|#dddddd" |
| 121 | + BorderColor="color name|#dddddd" |
| 122 | + BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double| |
| 123 | + Groove|Ridge|Inset|Outset" |
| 124 | + BorderWidth="size" |
| 125 | + ChildNodesPadding="size" |
| 126 | + CssClass="string" |
| 127 | + Font-Bold="True|False" |
| 128 | + Font-Italic="True|False" |
| 129 | + Font-Names="string" |
| 130 | + Font-Overline="True|False" |
| 131 | + Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small| |
| 132 | + Medium|Large|X-Large|XX-Large" |
| 133 | + Font-Strikeout="True|False" |
| 134 | + Font-Underline="True|False" |
| 135 | + ForeColor="color name|#dddddd" |
| 136 | + Height="size" |
| 137 | + HorizontalPadding="size" |
| 138 | + ImageUrl="uri" |
| 139 | + NodeSpacing="size" |
| 140 | + OnDisposed="Disposed event handler" |
| 141 | + VerticalPadding="size" |
| 142 | + Width="size" |
| 143 | + /> |
| 144 | + <LevelStyles> |
| 145 | + <asp:TreeNodeStyle |
| 146 | + BackColor="color name|#dddddd" |
| 147 | + BorderColor="color name|#dddddd" |
| 148 | + BorderStyle="NotSet|None|Dotted|Dashed|Solid| |
| 149 | + Double|Groove|Ridge|Inset|Outset" |
| 150 | + BorderWidth="size" |
| 151 | + ChildNodesPadding="size" |
| 152 | + CssClass="string" |
| 153 | + Font-Bold="True|False" |
| 154 | + Font-Italic="True|False" |
| 155 | + Font-Names="string" |
| 156 | + Font-Overline="True|False" |
| 157 | + Font-Size="string|Smaller|Larger|XX-Small| |
| 158 | + X-Small|Small|Medium|Large|X-Large|XX-Large" |
| 159 | + Font-Strikeout="True|False" |
| 160 | + Font-Underline="True|False" |
| 161 | + ForeColor="color name|#dddddd" |
| 162 | + Height="size" |
| 163 | + HorizontalPadding="size" |
| 164 | + ImageUrl="uri" |
| 165 | + NodeSpacing="size" |
| 166 | + OnDisposed="Disposed event handler" |
| 167 | + VerticalPadding="size" |
| 168 | + Width="size" |
| 169 | + /> |
| 170 | + </LevelStyles> |
| 171 | + <Nodes> |
| 172 | + <asp:TreeNode |
| 173 | + Checked="True|False" |
| 174 | + Expanded="string" |
| 175 | + ImageToolTip="string" |
| 176 | + ImageUrl="uri" |
| 177 | + NavigateUrl="uri" |
| 178 | + PopulateOnDemand="True|False" |
| 179 | + SelectAction="Select|Expand|SelectExpand|None" |
| 180 | + Selected="True|False" |
| 181 | + ShowCheckBox="string" |
| 182 | + Target="string" |
| 183 | + Text="string" |
| 184 | + ToolTip="string" |
| 185 | + Value="string" |
| 186 | +> |
| 187 | + </asp:TreeNode> |
| 188 | + </Nodes> |
| 189 | + <NodeStyle |
| 190 | + BackColor="color name|#dddddd" |
| 191 | + BorderColor="color name|#dddddd" |
| 192 | + BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double| |
| 193 | + Groove|Ridge|Inset|Outset" |
| 194 | + BorderWidth="size" |
| 195 | + ChildNodesPadding="size" |
| 196 | + CssClass="string" |
| 197 | + Font-Bold="True|False" |
| 198 | + Font-Italic="True|False" |
| 199 | + Font-Names="string" |
| 200 | + Font-Overline="True|False" |
| 201 | + Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small| |
| 202 | + Medium|Large|X-Large|XX-Large" |
| 203 | + Font-Strikeout="True|False" |
| 204 | + Font-Underline="True|False" |
| 205 | + ForeColor="color name|#dddddd" |
| 206 | + Height="size" |
| 207 | + HorizontalPadding="size" |
| 208 | + ImageUrl="uri" |
| 209 | + NodeSpacing="size" |
| 210 | + OnDisposed="Disposed event handler" |
| 211 | + VerticalPadding="size" |
| 212 | + Width="size" |
| 213 | + /> |
| 214 | + <ParentNodeStyle |
| 215 | + BackColor="color name|#dddddd" |
| 216 | + BorderColor="color name|#dddddd" |
| 217 | + BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double| |
| 218 | + Groove|Ridge|Inset|Outset" |
| 219 | + BorderWidth="size" |
| 220 | + ChildNodesPadding="size" |
| 221 | + CssClass="string" |
| 222 | + Font-Bold="True|False" |
| 223 | + Font-Italic="True|False" |
| 224 | + Font-Names="string" |
| 225 | + Font-Overline="True|False" |
| 226 | + Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small| |
| 227 | + Medium|Large|X-Large|XX-Large" |
| 228 | + Font-Strikeout="True|False" |
| 229 | + Font-Underline="True|False" |
| 230 | + ForeColor="color name|#dddddd" |
| 231 | + Height="size" |
| 232 | + HorizontalPadding="size" |
| 233 | + ImageUrl="uri" |
| 234 | + NodeSpacing="size" |
| 235 | + OnDisposed="Disposed event handler" |
| 236 | + VerticalPadding="size" |
| 237 | + Width="size" |
| 238 | + /> |
| 239 | + <RootNodeStyle |
| 240 | + BackColor="color name|#dddddd" |
| 241 | + BorderColor="color name|#dddddd" |
| 242 | + BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double| |
| 243 | + Groove|Ridge|Inset|Outset" |
| 244 | + BorderWidth="size" |
| 245 | + ChildNodesPadding="size" |
| 246 | + CssClass="string" |
| 247 | + Font-Bold="True|False" |
| 248 | + Font-Italic="True|False" |
| 249 | + Font-Names="string" |
| 250 | + Font-Overline="True|False" |
| 251 | + Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small| |
| 252 | + Medium|Large|X-Large|XX-Large" |
| 253 | + Font-Strikeout="True|False" |
| 254 | + Font-Underline="True|False" |
| 255 | + ForeColor="color name|#dddddd" |
| 256 | + Height="size" |
| 257 | + HorizontalPadding="size" |
| 258 | + ImageUrl="uri" |
| 259 | + NodeSpacing="size" |
| 260 | + OnDisposed="Disposed event handler" |
| 261 | + VerticalPadding="size" |
| 262 | + Width="size" |
| 263 | + /> |
| 264 | + <SelectedNodeStyle |
| 265 | + BackColor="color name|#dddddd" |
| 266 | + BorderColor="color name|#dddddd" |
| 267 | + BorderStyle="NotSet|None|Dotted|Dashed|Solid|Double| |
| 268 | + Groove|Ridge|Inset|Outset" |
| 269 | + BorderWidth="size" |
| 270 | + ChildNodesPadding="size" |
| 271 | + CssClass="string" |
| 272 | + Font-Bold="True|False" |
| 273 | + Font-Italic="True|False" |
| 274 | + Font-Names="string" |
| 275 | + Font-Overline="True|False" |
| 276 | + Font-Size="string|Smaller|Larger|XX-Small|X-Small|Small| |
| 277 | + Medium|Large|X-Large|XX-Large" |
| 278 | + Font-Strikeout="True|False" |
| 279 | + Font-Underline="True|False" |
| 280 | + ForeColor="color name|#dddddd" |
| 281 | + Height="size" |
| 282 | + HorizontalPadding="size" |
| 283 | + ImageUrl="uri" |
| 284 | + NodeSpacing="size" |
| 285 | + OnDisposed="Disposed event handler" |
| 286 | + VerticalPadding="size" |
| 287 | + Width="size" |
| 288 | + /> |
| 289 | +</asp:TreeView> |
| 290 | +``` |
| 291 | + |
| 292 | +##### [Back to top](#treeview) |
| 293 | + |
| 294 | +## Blazor Syntax |
| 295 | + |
| 296 | +##### [Back to top](#treeview) |
| 297 | + |
0 commit comments