Silverlight DataContext Changed Event (VB.NET)
#Region "Interfaces"
Public Interface IDataContextChangedHandler(Of T As FrameworkElement)
Sub DataContextChanged(sender As T, e As DependencyPropertyChangedEventArgs)
End Interface
Public NotInheritable Class DataContextChangedHelper(Of T As {FrameworkElement, IDataContextChangedHandler(Of T)})
Private Const INTERNAL_CONTEXT As String = "InternalDataContext"
Public Shared ReadOnly InternalDataContextProperty As DependencyProperty =
DependencyProperty.Register(INTERNAL_CONTEXT, GetType([Object]), GetType(T), New PropertyMetadata(AddressOf _DataContextChanged))
Public Shared Sub _DataContextChanged(sender As Object, e As DependencyPropertyChangedEventArgs)
Dim control As T = DirectCast(sender, T)
control.DataContextChanged(control, e)
End Sub
Public Shared Sub Bind(control As T)
control.SetBinding(InternalDataContextProperty, New Binding)
End Sub
End Class
#End Region
Authored originally by the Jeremy Likness
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment