Private Sub InPanel_ValidateCurrentItem(sender As Object, e As CancelEventArgs) _
Handles InPanel.ValidateCurrentItem
Dim inputPanel As C1InputPanel = TryCast(sender, C1InputPanel)
Dim customer As Customer = TryCast(inputPanel.CurrentItem, Customer)
If customer IsNot Nothing Then
Dim errorList = New ObservableCollection(Of ErrorInfo)()
If customer.Name IsNot Nothing AndAlso _
String.IsNullOrWhiteSpace(customer.Name.ToString()) Then
errorList.Add(New ErrorInfo() With { _
.ErrorInputName = "名前", _
.ErrorContent = "このフィールドは空にすることはできません。" _
})
End If
If customer.Weight > 110 Then
errorList.Add(New ErrorInfo() With { _
.ErrorInputName = "体重", _
.ErrorContent = "値が範囲外です" _
})
End If
inputPanel.ValidationErrors = errorList
If errorList.Count > 0 Then
e.Cancel = True
End If
End If
End Sub