8,735
社区成员
发帖
与我相关
我的任务
分享
'--------------------源对象
Public bigobj As New Big
'--------------------数据
Public Class Big
Private _d1 As Little1
Private _d2 As Little2
Public Property D1() As Little1
Get
Return _d1
End Get
Set(ByVal value As Little1)
_d1 = value
End Set
End Property
Public Property D2() As Little2
Get
Return _d2
End Get
Set(ByVal value As Little2)
_d2 = value
End Set
End Property
End Class
Public Class Little1
Private _x(5) As Integer
Public Property X(ByVal i As Integer) As Integer
Get
Return _x(i)
End Get
Set(ByVal value As Integer)
_x(i) = value
'????
End Set
End Property
End Class
Public Class Little2
Private _y As Integer
Public Property Y() As Integer
Get
Return _y
End Get
Set(ByVal value As Integer)
_y = value
'????
End Set
End Property
End Class
'--------------------控件
Public Class MyCanvas
Inherits Canvas
Private Tx(5), Ty As TextBox
Public Sub New()
CreateBinding()
End Sub
Public Sub CreateBinding()
Dim bind As New Binding()
'????
End Sub
End Class
bind = New Binding("D1.X(0)")
Private Sub CreateBinding()
Dim bind As New Binding
bind.Source = bigobj
For i As Int32 = 0 To 5
bind.Path = New PropertyPath("D1.X(" & i & ")")
Tx(i).SetBinding(TextBox.TextProperty, bind)
Next
bind.Path = New PropertyPath("D2.Y")
Ty.SetBinding(TextBox.TextProperty, bind)
End Sub
Public Event PropertyChanged As PropertyChangedEventHandler Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged
Public Sub OnPropertyChanged(ByVal e As PropertyChangedEventArgs)
If Not PropertyChangedEvent Is Nothing Then
RaiseEvent PropertyChanged(Me, e)
End If
End Sub
Public Sub OnPropertyChanged(ByVal propName As String)
If Not PropertyChangedEvent Is Nothing Then
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propName))
End If
End Sub
Public Property D1() As Little1
Get
Return _d1
End Get
Set(ByVal value As Little1)
_d1 = value
OnPropertyChanged("D1")
End Set
End Property