【发布时间】:2011-10-04 14:22:46
【问题描述】:
我的绑定树视图适用于字符串属性,但不适用于“另一个属性的属性”。
我的代码:
Public class A
Public data as string
End Class
Public Class T
Public o As A
Public ReadOnly Property desc As String
Get
Return o.data
End Get
End Property
Property children As New ObservableCollection(Of T)()
End Class
有效的xaml:
<sdk:HierarchicalDataTemplate x:Key="NameTemplate"
ItemsSource="{Binding Path=children}" >
<TextBlock Text="{Binding Path=desc}" FontWeight="Bold" />
</sdk:HierarchicalDataTemplate>
不起作用的xaml:
<sdk:HierarchicalDataTemplate x:Key="NameTemplate"
ItemsSource="{Binding Path=children}" >
<TextBlock Text="{Binding Path=o.data}" FontWeight="Bold" />
</sdk:HierarchicalDataTemplate>
什么是错误? 谢谢。
【问题讨论】:
-
A.data 不是属性,如果我正确理解 vb 语法的话。
标签: silverlight binding treeview