It is often require to update a portion of the user interface periodically. In that case, a timer object is beneficial to keep the UI refreshed. For example, in your application, you may want to show the current time at some part of the UI. For this, you can use a timer to periodically update the UI without the need to create a different thread.
The System.Windows.Threading.DispatcherTimer class can be used to integrate into the Dispatcher queue, and can process at a specified interval of time and at a specified priority.
In this recipe, we will use the DispatcherTimer class to implement a timer, which will execute its subscribed Tick event each time the specified Interval is met.