This project is read-only.

BXF Trigger Action for CSLA.NET, Silverlight application

Jul 24, 2013 at 10:30 AM
Edited Jul 24, 2013 at 10:31 AM
Hello,

I'm using CSLA 4.5.30 with my silverlight MVVM application. I have a viewModel class deriving from ViewModelBase, which does not have any BeginRefersh() call in my constructor. Calls to BeginRefresh() are event driven.

I am putting BXF Trigger Action for Loaded event of textbox. Method adds RX observer to this textbox but method never called.

If use same functionality in some other viewmodel class which has BeginRefresh() call in constructor, then it works.

In Xaml ----
<TextBox Name="TextBox1"></TextBox>

<bxf:TriggerAction TriggerEvent="Loaded" MethodName="AttachRXObserver" TargetControl="{Binding ElementName=TextBox1}"></bxf:TriggerAction>
In ViewModel -----
public void AttachRXObserver(object sender, Bxf.Xaml.ExecuteEventArgs e)
{
            if (e.TriggerSource is TextBox)
            {
                //RX Observer for KeyUp Event of Serach TextBox
                var subscription1 = Observable.FromEventPattern<KeyEventArgs>((TextBox)e.TriggerSource, "KeyUp")
                                .Throttle(TimeSpan.FromSeconds(1));
                subscription1.Subscribe(pattern => Deployment.Current.Dispatcher.BeginInvoke(
                                       () =>
                                       {
                                           // Do some Task
                                       }
                                       ));
           }
}