I have a button command which sends several emails and therefore takes a few seconds for the method to execute. I want to show a progress ring Mahapps.Metro
& disable the view whilst this method is executing.
Here's my ProgressRing
in my view:
<Controls:ProgressRing IsActive="True" Visibility="{Binding IsProgressRingVisible, UpdateSourceTrigger=PropertyChanged}" />
ViewModel
property:
private Visibility _IsProgressRingVisible;
public Visibility IsProgressRingVisible
{
get { return _IsProgressRingVisible; }
set
{
_IsProgressRingVisible = value;
OnPropertyChanged("IsProgressRingVisible");
}
}
& finally my button command logic:
private void DisableView()
{
IsProgressRingVisible = Visibility.Visible;
IsEditable = false;
}
private void ApprovePublicationCommandAction()
{
DisableView();
try
{
Send emails blah bah
Obviously the command method logic runs before the UI is notified & changes the ProgressRing
Visibility. Is there a way I can show the ProgressRing
then carry on executing the Command logic?