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

  • Home
  • SEARCH
  • 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 8807367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:21:07+00:00 2026-06-14T02:21:07+00:00

Here is what I am trying to achieve (in a .Net 4 WPF client):

  • 0

Here is what I am trying to achieve (in a .Net 4 WPF client):

  1. User types some text in a text box
  2. After half a second of no more typing, text is sent asynchronously sent to a server for validation
  3. Validation result is shown to the user (this is just text bound to a text block)
  4. If the user types more text while the validation is in progress (this takes a couple of seconds) the results from server are ignored and a new validation request is sent instead

From what I have read reactive extensions are a good fit for this but I’m having trouble, in particular step 4.

Secondly I am using mvvm, so how do I put this logic in the view model while subscribing to TextBox.TextChanged in the view.

  • 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-06-14T02:21:08+00:00Added an answer on June 14, 2026 at 2:21 am

    A few operators come in quite handy here (notably, Throttle for 2 and Switch for 4). Your view model will look something like:

    Class ViewModel
        Implements INotifyPropertyChanged
        Implements IDisposable 'to clean up subscription
    
        Public Sub New()
            _subscription = Observable.FromEventPattern(Of PropertyChangedEventHandler, PropertyChangedEventArgs)(
                                Sub(h) AddHandler Me.PropertyChanged, h,
                                Sub(h) RemoveHandler Me.PropertyChanged, h) _
                            .Where(Function(ep) String.Equals(ep.EventArgs.PropertyName, "Input", StringComparison.Ordinal)) _
                            .Throttle(TimeSpan.FromSeconds(0.5)) _
                            .Select(Function(ep) Validate(Me.Input)) _
                            .Switch() _
                            .ObserveOnDispatcher() _
                            .Subscribe(Sub(v) Me.Output = v)
        End Sub
    
        Private ReadOnly _subscription As IDisposable
    
        'put in actual code to notify on change
        Public Property Input As String
        Public Property Output As ValidationResult
    
        Private Function Validate(toValidate As String) As IObservable(Of ValidationResult)
            'start validation
        End Function
    
        Public Event PropertyChanged(sender As Object, e As PropertyChangedEventArgs) Implements INotifyPropertyChanged.PropertyChanged
    End Class
    

    From the view, bind the text box to Input and set the binding mode to PropertyChanged (instead of the default LostFocus). The result block can then bind to Output.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's what I'm trying to achieve: Before: www.example.com/index.php?page=about&pg=5 After: www.example.com/about.html?pg=5 The URL must specifically
Here's the jfiddle for what I'm trying to achieve: http://jsfiddle.net/fmvmA/ I have two issues
Here's what I am trying to achieve. I am importing an xml file of
Here's what I'm trying to achieve: open a shell (korn or bash, doesn't matter),
I'm trying to achieve what this guy here is doing, only in PHP or
What i am trying to achieve here is a bit tricky. Let me brief
What I'm trying to achieve here is to be able to select every last
I am trying to achieve a table which has text rotated -90degrees. Up until
I am currently trying to achieve thread synchronization in C++ .net using only atomic
I am trying to achieve an effect where the correctly entered text will result

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.