本文整理汇总了VB.NET中System.Web.UI.IHierarchyData.HasChildren属性的典型用法代码示例。如果您正苦于以下问题:VB.NET IHierarchyData.HasChildren属性的具体用法?VB.NET IHierarchyData.HasChildren怎么用?VB.NET IHierarchyData.HasChildren使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.Web.UI.IHierarchyData 的用法示例。
在下文中一共展示了IHierarchyData.HasChildren属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: RecurseDataBindInternal
Private Sub RecurseDataBindInternal(ByVal node As TreeNode, _
ByVal enumerable As IHierarchicalEnumerable, _
ByVal depth As Integer)
Dim item As Object
For Each item In enumerable
Dim data As IHierarchyData = enumerable.GetHierarchyData(item)
If Not data Is Nothing Then
' Create an object that represents the bound data
' to the control.
Dim newNode As New TreeNode()
Dim rvnode As New RootViewNode()
rvnode.Node = newNode
rvnode.Depth = depth
' The dataItem is not just a string, but potentially
' an XML node or some other container.
' If DataTextField is set, use it to determine which
' field to render. Otherwise, use the first field.
If DataTextField.Length > 0 Then
newNode.Text = DataBinder.GetPropertyValue _
(data, DataTextField, Nothing)
Else
Dim props As PropertyDescriptorCollection = _
TypeDescriptor.GetProperties(data)
' Set the "default" value of the node.
newNode.Text = String.Empty
' Set the true data-bound value of the TextBox,
' if possible.
If props.Count >= 1 Then
If Not props(0).GetValue(data) Is Nothing Then
newNode.Text = props(0).GetValue(data).ToString()
End If
End If
End If
Nodes.Add(rvnode)
If data.HasChildren Then
Dim newEnumerable As IHierarchicalEnumerable = _
data.GetChildren()
If Not (newEnumerable Is Nothing) Then
RecurseDataBindInternal(newNode, _
newEnumerable, depth + 1)
End If
End If
If MaxDepth < depth Then
MaxDepth = depth
End If
End If
Next item
End Sub
开发者ID:VB.NET开发者,项目名称:System.Web.UI,代码行数:60,代码来源:IHierarchyData.HasChildren
注:本文中的System.Web.UI.IHierarchyData.HasChildren属性示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论