本文整理匯總了VB.NET中System.Windows.Data.BindingGroup.Name屬性的典型用法代碼示例。如果您正苦於以下問題:VB.NET BindingGroup.Name屬性的具體用法?VB.NET BindingGroup.Name怎麽用?VB.NET BindingGroup.Name使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類System.Windows.Data.BindingGroup
的用法示例。
在下文中一共展示了BindingGroup.Name屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: New
Public Class Type1
Public Property PropertyA() As String
Public Sub New()
PropertyA = "Default Value"
End Sub
End Class
Public Class Type2
Public Property PropertyB() As String
Public Sub New()
End Sub
End Class
Public Class BindingGroupValidationRule
Inherits ValidationRule
Public Overrides Function Validate(ByVal value As Object, ByVal cultureInfo As System.Globalization.CultureInfo) As ValidationResult
Dim bg As BindingGroup = TryCast(value, BindingGroup)
Dim object1 As Type1 = Nothing
Dim object2 As Type2 = Nothing
For Each item As Object In bg.Items
If TypeOf item Is Type1 Then
object1 = TryCast(item, Type1)
End If
If TypeOf item Is Type2 Then
object2 = TryCast(item, Type2)
End If
Next item
If object1 Is Nothing OrElse object2 Is Nothing Then
Return New ValidationResult(False, "BindingGroup did not find source object.")
End If
Dim string1 As String = TryCast(bg.GetValue(object1, "PropertyA"), String)
Dim string2 As String = TryCast(bg.GetValue(object2, "PropertyB"), String)
If string1 <> string2 Then
Return New ValidationResult(False, "The two strings must be identical.")
End If
Return ValidationResult.ValidResult
End Function
End Class