Friday, June 1, 2018

WPF Busy Overlay

Greetings all!
I've been doing some research on how to add an overlay feature similar to an Ajax busy modal to one of my WPF projects. A simple approach led me to this topic WPF: Simple "Busy" Overlay. Since I'm using the traditional MVVM and not Simon Cropp’s Notify Property Weaver, I made this work by creating a WPF project using Visual Studio 2017 (installed in my workstation) and then copied the codes specifically BoolToVisibilityConverter.cs, BusyViewModel.cs, DelegateCommand.cs and MainWindow.xaml from his example at BitBucket. I also changed the IsBusy property to implement the OnPropertyChanged event
private bool _IsBusy;
public bool IsBusy
 get { return _IsBusy; }
  _IsBusy = value;
and added the implementation of that event.
protected void OnPropertyChanged(string propertyName)
 if (PropertyChanged != null)
  PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
After the changes have been reflected, the overlay shows after clicking the Do Something link.
Source Code At Github.


Post a Comment