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 6902587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:49:00+00:00 2026-05-27T07:49:00+00:00

How does one ignore changes to a control when databinding occurs? I tried hooking

  • 0

How does one ignore changes to a control when databinding occurs? I tried hooking various events like gotfocus,textchanged,and leavefocus, but if the control already has focus and the user “cancels” their changes, when I reload the record and data binding takes over, textchanged thinks the user still made the change since the focus is on that control. The call stack is empty. Are there any global data binding events like databinding starting and databinding ending? I see where I fire my OnProperyChanged but within that call, databinding does not occur. Looks like it’s getting “queued” up and runs at some other point.

At one point, I was going to hook the property change events in our view model , but this means I won’t detect and can’t VISUALLY display the form is modified till the user leaves the control. I know, I know, I can change all my bindings so that binding occurs immediately on every character change but then this messes with some validation cases as the user hasn’t finished typing in their value.

I’d really love some kind of event like TextChangedByUser that would fire whether the user used a key, clipboard, mouse clipboard, anything triggered by the user.

I just can’t figure out how to distinguish between user changes and databinding changes.

  • 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-27T07:49:01+00:00Added an answer on May 27, 2026 at 7:49 am

    I’d really love some kind of event like TextChangedByUser that would
    fire whether the user used a key, clipboard, mouse clipboard, anything
    triggered by the user.

    I just can’t figure out how to distinguish between user changes and
    databinding changes.

    Don’t use the Text.TextChanged event to detect user input,
    use the Binding.SourceUpdated event instead.

    Or more general:
    Don’t use the DPs of your visual elements to detect user updates, use the Binding.SourceUpdated event instead.

    This is a RoutedEvent.
    At your binding, you have to set NotifyOnSourceUpdated = true. With help of UpdateSourceTrigger you are even able to finetune when you want to be informed.


    Your xaml could be sth like this:

    <Grid x:Name="LayoutRoot" Binding.SourceUpdated="LayoutRoot_SourceUpdated">
        ...
        <TextBox>
            <TextBox.Text>
                <Binding NotifyOnSourceUpdated="True" Path="path" UpdateSourceTrigger="PropertyChanged" >
                </Binding>
            </TextBox.Text>
    </Grid>
    

    Your event could be like this:

    private void LayoutRoot_SourceUpdated(object sender, DataTransferEventArgs e)
    {
        // called every time s.th. changed by user
    }
    

    (edited due to comment)
    Why is this a valid way to detect if an input is triggered in any way by the user?
    In the given example, the TextBox’s DataContext ‘path’ property is the source, while the ‘TextBox.Text’ property is the target.
    [Data Binding Overview]http://msdn.microsoft.com/en-us/library/ms752347.aspx
    The TextBox.Text property is changed for the first time when the binding initializes and the source-value is written to the ‘TextBox.Text’ property. Because you do not know when the binding takes place exactly you cannot use the TextBox.Text property or any of its events (e.g. TextChanged) to detect a user input. Hence:
    Don’t use the Text.TextChanged event to detect user input!!! more general: Don’t use the DPs of your visual elements to detect user updates!!!

    If the user changes the content of the visual text field by which means whatsoever, the ‘TextBox.Text’ property changes (your target).After that, the binding updates the source at a time defined by UpdateSourceTrigger.That’s when the SourceUpdated event is fired.

    I admit not to know the effect of changes to the binding source from outside the binding.
    But I have a complete Editor-like Desktop-Application detecting changes by the user that way and it is working very nicely.

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

Sidebar

Related Questions

Does anybody know of a diff-like tool that can show me the changes between
does one perform better over the other in terms of indexing/quering etc ? e.g.
How does one go about authoring a Regular Expression that matches against all strings
How does one go about referencing a class's static properties in xaml? In other
How does one convert an image from one color profile to another (screen to
How does one go about programatically building a TemplateColumn object and adding it to
How does one handle a DateTime with a NOT NULL ? I want to
How does one invoke a groovy method that prints to stdout, appending the output
How does one start development in Silverlight? Does one need a new IDE? or
How does one do this? If I want to analyze how something is getting

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.