Guest User

Untitled

a guest
Aug 14th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. Controlling event-driven navigation in a WPF application
  2. For Each ThisControl In MainListView.
  3. Dim ThisControlType = ThisControl.GetType
  4. Dim ThisControlPropertyChangedEvent = ThisControlType.GetEvent("PropertyChanged")
  5. ' you might wanna check here if event is not null / nothing
  6. ThisControlPropertyChangedEvent.AddEventHandler(ThisControl, New PropertyChangedEventHandler(AddressOf APropChanged))
  7. Next
  8.  
  9. Public Sub APropChanged(ByVal sender As Object, ByVal e As PropertyChangedEventArgs)
  10. If e.PropertyName = "Validated" Then
  11. Dim ValidatedForAll = True
  12. For Each ThisControl In MainListView.Items
  13. Dim ThisControlType = ThisControl.GetType
  14. Dim ThisControlValidatedProperty = ThisControlType.GetProperty("Validated")
  15. 'you might wanna check for non null here
  16. If Not ThisControlValidatedProperty.GetValue(ThisControl, Nothing) Then
  17. ValidatedForAll = False
  18. Exit For
  19. End If
  20. Next
  21. If ValidatedForAll Then
  22. MessageBox.Show("Yeeppee") ' you might send an event instead.
  23. End If
  24. End If
  25. End Sub
Add Comment
Please, Sign In to add comment