本文整理匯總了VB.NET中System.Windows.Data.BindingGroup.GetValue方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET BindingGroup.GetValue方法的具體用法?VB.NET BindingGroup.GetValue怎麽用?VB.NET BindingGroup.GetValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Data.BindingGroup
的用法示例。
在下文中一共展示了BindingGroup.GetValue方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: AreasMatch
Public Class AreasMatch
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 cust As Customer = TryCast(bg.Items(0), Customer)
If cust Is Nothing Then
Return New ValidationResult(False, "Customer is not the source object")
End If
Dim region As Region = CType(bg.GetValue(cust, "Location"), Region)
Dim rep As ServiceRep = TryCast(bg.GetValue(cust, "ServiceRepresentative"), ServiceRep)
Dim customerName As String = TryCast(bg.GetValue(cust, "Name"), String)
If region = rep.Area Then
Return ValidationResult.ValidResult
Else
Dim sb As New StringBuilder()
sb.AppendFormat("{0} must be assigned a sales representative that serves the {1} region. " & vbLf & " ", customerName, region)
Return New ValidationResult(False, sb.ToString())
End If
End Function
End Class