Is there a known issue with TriggerAction and TextChanged events?

Jul 20, 2011 at 9:38 PM
Edited Jul 21, 2011 at 5:26 PM

I'm attempting to bind a TriggerAction toa Silverlight TextBox's TextChanged event.  The method I specify on my ViewModel is getting called at runtime but the designer (Cider) will not load after the TriggerAction has been set up and the project is recompiled.  The designer shows a System.MissingMethodException.  I should note that I'm using other TriggerAction bound to different controls on the same page though they are bound to simpler events, e.g. Click.

Jul 21, 2011 at 4:42 PM

Usually this type of problem is because the designer is running your real code, and the viewmodel is doing something (like trying to load a model object from the database) that can't be done at design time.

I suppose it is possible that the TextChanged event is actually being raised as the designer loads the XAML. That wouldn't be entirely surprising, because data binding works within the designer, so the text value really could be changing. That could result in some of your viewmodel code being run at design time - code that won't work within the designer?

Jul 21, 2011 at 5:12 PM
Edited Jul 21, 2011 at 5:55 PM

Yeah, I'd assumed that the designer was actually firing the event but that doesn't explain the exception because the target method for the TriggerAction is completely empty at this point.  Also, the exception is a MissingMethodException which tells me the designer can't even find the method being referenced.  I'd just assume that I have something wired up wrong and keep looking except for the fact that I can run the application and watch the TriggerAction's target method being called in the VM class when the TextBox's text changes using the debugger.  It's very strange to me that this empty method is getting called at runtime correctly but can't be found in the designer.

I've recreated this behavior with a super simple Silverlight application which I'd include but I don't see a way to attach it.  I simply created a stand alone Silverlight 4 application (no website), added references to Csla.Xaml.dll and Csla.dll, created a class with one method to act as a ViewModel, dropped a TextBox and an TriggerAction to the page, added an instance of the ViewModel class to the UserContro.Resources, bound the root layout Grid to the ViewModel and tied the TriggerAction to the TextBox's TextChanged event and the single empty method in the ViewModel.  I get the same behavior, i.e. the method gets called on any TextChanged in the TextBox at runtime but the designer throws and exception.

Also, should I be posting this here or on the Csla forum?  I'd orignally posted on the Csla forum but was told I should post here because it's a Bxf issue.  After looking closer I see that TriggerAction is in Csla.Xaml.dll not Bxf.dll.