This project has moved. For the latest updates, please go here.

MessageBox causing strange pause in command execution

Feb 22, 2011 at 10:00 PM

We have a button, using MVVM, with a command:

<Button ... Command="{Binding DeleteMessageCommand}"/>

This button is in the header template of a tab control.  The strange thing that happens is, when I show a MessageBox, the next command takes at least 5 clicks to register (tho it varies... leading me to think maybe it is time based).  The command never gets called for a period of time/clicks.  All buttons in the template exhibit this behavior (not just the one clicked).  It's like the entire template is disabled for a certain amount of time.  Have you ran into anything like this?

If I take the MessageBox out, the button click commands fire every time perfectly.

We are using Prism, but I really dont think at this point that it is Prism.  It is just a view model bound to a view, with commands bound to the button.

Here is the code of the command (in the view model):

private void DeleteMessageExecuted(object sender)
{
	MessageTemplate t;
	if (sender is MessageTemplate)
	{
	    t = sender as MessageTemplate;
		if (MessageBox.Show("Delete " + t.MessageName + "?", "Delete " + t.MessageName + "?", System.Windows.MessageBoxButton.YesNoCancel, System.Windows.MessageBoxImage.Warning) == System.Windows.MessageBoxResult.Yes)
		{
			Messages.Remove(t);
			RaisePropertyChanged(MessagesPropertyName);
		}
	}
}

Feb 22, 2011 at 10:03 PM

I myself use this same scenario in Prism applications, but do not experience the issue you are describing.  Could you provide a simple working example that will duplicate the issue?

Feb 23, 2011 at 3:16 PM

In making a sample application, I found out that is is the Telerik RadTabControl that is causing the problem.  (If I use a regular TabControl, Extended WPF ToolKit MessageBox works fine).  

I will take it up with Telerik, or just use the plain old TabControl.

 

Thanks,

Brian

Feb 24, 2011 at 3:11 AM

you may want to test with a normal MessageBox as well.