2016-09-07 50 views

回答

1

Validation.Error是一個附加事件,所以要加一個處理程序代碼隱藏,你必須使用此語法:

MyControl.AddHandler(Validation.ErrorEvent, New RoutedEventHandler(AddressOf MyEventHandler)) 

其中一個MyEventHandler就像任何其他WPF事件處理程序:

Private Sub MyEventHandler(sender as object, e as RoutedEventArgs) 
    Dim args as ValidationErrorEventArgs = DirectCast(e, ValidationErrorEventArgs) 
    'Do stuff 
End Sub