Benjamin Jones
Benjamin Jones

Reputation: 997

WPF Possible to disable all click events in Window

Would it be possible to disable all click events (mainly buttons) in a Window for 10 seconds, then re enable them?. I realize I could write code to manually disable all click events by calling them out: button1.IsEnabled=False (so on). However I have a lot of click events and I just wanted to see if I could disable them an easier way? If not its fine.

Example:

 Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles Button4.Click

'Disable all click events in Window.
' timer to count to 10 then. 
' Enable all click events in Window.
End Sub

Upvotes: 2

Views: 5303

Answers (1)

Tom Studee
Tom Studee

Reputation: 10452

You should be able to achieve this by setting IsHitTestVisible = False on the Window.

If you want them to appear disabled, I believe you can just set .IsEnabled = False

Upvotes: 3

Related Questions