When I used to write a lot of Ajax for ASP.NET (many years ago) I quite like the feature whereby you could disable the page and show a ‘loading spinner’ while waiting for an update in the page.
This is a great feature to have in WPF, so I have created a ViewModel with a ‘loading’ switch (bool), and an attached property that creates and displays the animated spinner (for the duration of the switch flag being true)
Firstly, we need a control template for a content control that will be our animated spinner.
The Content property of out content presenter will include our text message that will be inside the spinner
Next we need our attached property class
Now our ViewModel
Heres out Window that uses the attached property to include a spinner
And finally our code behind