BXF Trigger Action for Silverlight

BXF Trigger Action for Silverlight

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


Rahul.Kadam posted on Wednesday, July 17, 2013

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 is never called.

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

<bxf:TriggerAction TriggerEvent="Loaded" MethodName="AttachRXObserver" TargetControl="{Binding ElementName=txtBox}"></bxf:TriggerAction>

Please help.

mayurimalgave replied on Friday, July 19, 2013

Hii... Can you just send the code of your xaml & viewmodel?

Rahul.Kadam replied on Friday, July 19, 2013

In Xaml ----

<TextBox Width="280" 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
                                       }
                                       ));
           }
}

Copyright (c) Marimer LLC