Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

WPF Loading Wait Adorner

0.00/5 (No votes)
5 Dec 2016 2  
This is an alternative for WPF Loading Wait Adorner

Introduction

I was looking for a control to display a wait condition, and discovered https://www.codeproject.com/Articles/57984/WPF-Loading-Wait-Adorner by The control provided the basic capabilities I was looking for, but I found a few things that could be improved upon. The initial problem I had was that the sample used code behind, and I thought that I would have to create a DependencyProperty, but he actaully had created a DependencyProperty, he just did not use this capability in the sample, Hard to understand how to use a Control iwth the MVVM design pattern if you do not show use of the DependencyProperty in the sample. Another serious problem was the naming for the Control and its content.

Changes

  • In the sample, binding is not used to make the control visible. I updated the sample so that it uses binding.
  • Renamed the wait adorner (AdornedControl) to WaitAdorner and the LoadingWait UserControl to RotatingDotsWaitAdorner. I felt these were more descriptive names.
  • In the sample included a ToggleButton in AdornerContent for the WaitAdorner which will clear the wait. The IsChecked property is is bound to an IsWaiting property in a ViewModel that is also bound to a ToggleButton to initialize the wait, and the IsAdornerVisible property fo the WaitAdorner.
  • The "Start/Stop Waiting" ToggleButton is renamed "Start Waiting" and included within the WaitAdorner. The way to stop the waiting is the "Cancel" ToggleButton in the AdornerContent. ToggleButton controls are used to simplify the ViewModel. In actuality would probably use a Button in the AdornerContent, and use a Binding to an ICommand.
  • Did some refactoring, and included use of features available in C# 6.0.

History

2016-12-05: Initial Version

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here