TriggerAction bound to TextChanged event of Silverlight TextBox?

TriggerAction bound to TextChanged event of Silverlight TextBox?

Old forum URL: forums.lhotka.net/forums/t/10530.aspx


Dane posted on Sunday, July 17, 2011

Is there an issue with a TriggerAction bound to the TextChanged event of a Silverlight TextBox?  I'm getting an exception at TriggerAction.CallMethod every time I bind to TextChanged even when I specify a valid method name.

JonnyBee replied on Sunday, July 17, 2011

Hi Dane,

You should post Bxf questions on the Bxf discussion forum at
http://bxf.codeplex.com/discussions 

I believe this question is not related to Csla?

Dane replied on Wednesday, July 27, 2011

I re-posted this at codeplex as advised.  Rocky gave a quick response but I suspect that forum isn't monitored that well.  After looking at the issue further I discovered this is not a Bxf issue (TriggerAction resides in Csla.Xaml.dll not Bxf.dll).  I put together a super simple repro test and I believe there is an actual issue here.  I created a Silverlight 4 application project and added a simple class to mock a ViewModel.  This is the relevant Xaml:

<UserControl.Resources>

<my:MyViewModel x:Name="myViewModel" />

</UserControl.Resources>

 

<Grid x:Name="LayoutRoot" Background="White" DataContext="{Binding Source={StaticResource myViewModel}}">

<TextBox Height="23" HorizontalAlignment="Left" Margin="25,22,0,0" Name="textBox1" VerticalAlignment="Top" Width="120" />

       <csla:TriggerAction Name="triggerAction" MethodName="Foo" TargetControl="{Binding ElementName=textBox1}" TriggerEvent="TextChanged" />

</Grid> 

 

This is the class MyViewModel:

 

public class MyViewModel
{
    public void Foo()
    { }
}

 

If you run the application in VS2010 with a breakpoint on the Foo method in MyViewModel you will find that the method does indeed get called at runtime whenever text is changed in the TextBox.  However, Cider will not render the design surface.  Instead it shows the MissingMethodException previously described.

Copyright (c) Marimer LLC