Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3661442
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T01:18:21+00:00 2026-05-19T01:18:21+00:00

I am using Reactive extensions for NET (Rx) with Caliburn.Micro in my WPF app.

  • 0

I am using Reactive extensions for NET (Rx) with Caliburn.Micro in my WPF app. I’m trying to port my WPF app to use an MVVM architecture and I need to monitor changes in the Text property of a TextBox control.

If the last change of the Text property was more than 3 seconds ago I need to call the LoadUser method of a service.

Porting the logic from my old solution to the new solution with MVVM architecture.

OLD

XAML:

<TextBox Name="Nick" 
         Grid.Row="0"
         FontSize="14"
         Margin="2,2,2,2" 
         HorizontalAlignment="Stretch" 
         TextChanged="Nick_TextChanged" />

In code behind I have this:

...

Observable.FromEvent<TextChangedEventArgs>(Nick, "TextChanged")
          .Select(e => ((TextBox)e.Sender).Text)
          .Where(text => text.Length > 3)               
          .Do(LoadUser)     
          .Throttle(TimeSpan.FromSeconds(3000))     
          .Subscribe(LoadUser);

...
private  void LoadUser(string text){...}

I would like use Observable.FromEvent in my view model class. Something like this

WPF with MVVM

View:

<TextBox Name="Nick" 
         Grid.Row="0"
         FontSize="14"
         Margin="2,2,2,2" 
         HorizontalAlignment="Stretch"
         Micro:Message.Attach="[TextChanged]=[Action TextChanged()]"/>

View Model:

[Export(typeof(IAddFriendViewModel))]
public class AddFriendViewModel : Screen, IAddFriendViewModel
{
    private string _nick;

    public string Nick
    {
        get { return _nick; }
        set
        {
            _nick = value;
            NotifyOfPropertyChange(()=>Nick);
        }
    }

    ...

    //how can I access to textbox control Nick in view from view model class?
    Observable.FromEvent<TextChangedEventArgs>(Nick, "TextChanged")
              .Select(e => ((TextBox)e.Sender).Text)
              .Where(text => text.Length > 3)
              .Do(LoadUser)
              .Throttle(TimeSpan.FromSeconds(3000))
              .Subscribe(LoadUser);
    ...

    private void LoadUser(string text)
    { }

    public void TextChanged()
    {
    }
}

My problem is Observable.FromEvent uses the TextBox control and I don’t know how can I access this control from my ViewModel class.

I can bind to the Text property of TextBox or I can bind a command to some event of the TextBox control, but this method uses an object in the View.

Thank for ideas.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T01:18:21+00:00Added an answer on May 19, 2026 at 1:18 am

    Add a Nick property to your ViewModel and implement INotifyPropertyChanged. Then you can do this

    Observable.FromEventPattern<PropertyChangedEventArgs>(this, "PropertyChanged")
              .Where(e => e.EventArgs.PropertyName == "Nick")
              .Select(_ => this.Nick)
              .Where(text => text.Length > 3)
              //Subscribe will call LoadUser, no need for the extra Do(...)
              .Throttle(TimeSpan.FromSeconds(3000))
              .Subscribe(LoadUser);  
    

    and then your XAML would be something like this

    <TextBox Name="Nick" 
             Grid.Row="0"
             FontSize="14"
             Margin="2,2,2,2" 
             HorizontalAlignment="Stretch"
             Text="{Binding Nick, UpdateSourceTrigger=PropertyChanged}" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code in a WPF application using Reactive Extensions for .NET:
So I have a WPF application using the MVVM pattern (Caliburn.Micro). I got the
I want to put Reactive Extensions for .NET (Rx) to good use and would
I'm using reactive extensions in my wp7 app that I'm making and I wish
I am using Reactive Extensions to verification of a textbox input. I am trying
I've been trying to get my head around the Reactive Extensions for .NET of
I'm currently using the Parallel Extensions that are part of Reactive Extensions for .Net(Rx)
I was working on an app using Reactive Extensions and got into the following
I'm using Reactive Extensions for .NET (Rx) to expose events as IObservable<T> . I
I'm creating multiple asynchronous web requests using IObservables and reactive extensions. So this creates

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.