Click here to Skip to main content
15,867,308 members
Articles / Desktop Programming / WPF
Alternative
Article

WPF Loading Wait Adorner

Rate me:
Please Sign up or sign in to vote.
4.89/5 (10 votes)
5 Dec 2016CPOL1 min read 17.5K   612   11   14
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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) Clifford Nelson Consulting
United States United States
Has been working as a C# developer on contract for the last several years, including 3 years at Microsoft. Previously worked with Visual Basic and Microsoft Access VBA, and have developed code for Word, Excel and Outlook. Started working with WPF in 2007 when part of the Microsoft WPF team. For the last eight years has been working primarily as a senior WPF/C# and Silverlight/C# developer. Currently working as WPF developer with BioNano Genomics in San Diego, CA redesigning their UI for their camera system. he can be reached at qck1@hotmail.com.

Comments and Discussions

 
GeneralMy vote of 1 Pin
VEMS6-Dec-16 15:04
VEMS6-Dec-16 15:04 
Build errors 2013 ... builds on 2015

modified 8-Dec-16 15:53pm.

AnswerRe: My vote of 1 Pin
Clifford Nelson8-Dec-16 8:18
Clifford Nelson8-Dec-16 8:18 
GeneralRe: My vote of 1 Pin
VEMS8-Dec-16 9:48
VEMS8-Dec-16 9:48 
GeneralRe: My vote of 1 Pin
WPF Programmer9-Dec-16 10:38
WPF Programmer9-Dec-16 10:38 
GeneralRe: My vote of 1 Pin
VEMS9-Dec-16 11:29
VEMS9-Dec-16 11:29 
AnswerRe: My vote of 1 Pin
WPF Programmer12-Dec-16 5:17
WPF Programmer12-Dec-16 5:17 
GeneralRe: My vote of 1 Pin
VEMS12-Dec-16 5:31
VEMS12-Dec-16 5:31 
AnswerRe: My vote of 1 Pin
Clifford Nelson13-Dec-16 11:39
Clifford Nelson13-Dec-16 11:39 
GeneralRe: My vote of 1 Pin
VEMS12-Dec-16 5:32
VEMS12-Dec-16 5:32 
AnswerRe: My vote of 1 Pin
Clifford Nelson13-Dec-16 7:05
Clifford Nelson13-Dec-16 7:05 
GeneralRe: My vote of 1 Pin
VEMS13-Dec-16 7:11
VEMS13-Dec-16 7:11 
GeneralRe: My vote of 1 Pin
Clifford Nelson13-Dec-16 11:08
Clifford Nelson13-Dec-16 11:08 
GeneralRe: My vote of 1 Pin
VEMS13-Dec-16 12:13
VEMS13-Dec-16 12:13 
AnswerRe: My vote of 1 Pin
Clifford Nelson14-Dec-16 5:08
Clifford Nelson14-Dec-16 5:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.