Private WithEvents counterPanel As Panel
Private WithEvents timer As DispatcherTimer = New DispatcherTimer()
Private counter As Integer = 0
Private Sub PanelClick(ByVal sender As System.Object, _
ByVal e As System.Windows.Input.MouseButtonEventArgs) _
Handles counterPanel.MouseLeftButtonDown
If timer.IsEnabled Then timer.Stop() Else timer.Start()
End Sub
Private Sub TimerClick(ByVal sender As System.Object, _
ByVal e As EventArgs) Handles timer.Tick
counter += 1
counterPanel.Children.Clear()
Dim t As New TextBlock
t.Text = counter.ToString
counterPanel.Children.Add(t)
End Sub
Private Sub TestDispatcherTimer(ByVal p As Panel)
Me.counterPanel = p
timer.Interval = New TimeSpan(0, 0, 1)
timer.Start()
End Sub