1
我在後臺代碼中定義的自定義控制:綁定到自定義控件的屬性在代碼中定義的背後
Public Class MyControl
Inherits Button
Private _A As String
Private _B As String
Public Property A() As String
Get
Return A
End Get
Set(ByVal value As String)
_A = value
End Set
End Property
Public Property B() As String
Get
Return B
End Get
Set(ByVal value As String)
B = value
End Set
End Property
End Class
而這裏的標記:
<ControlTemplate TargetType="{x:Type local:MyControl}">
<StackPanel>
<TextBlock Text="{Binding ?????}"/> <!-- A Property -->
<TextBlock Text="{Binding ?????}"/> <!-- B Property -->
</StackPanel>
</ControlTemplate>
我有什麼代碼寫入到綁定對那些特性?
謝謝!這工作! :) – Cobold 2011-05-14 22:30:45