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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:08:37+00:00 2026-06-15T09:08:37+00:00

In the following sample, when I type a new string into the TextBox and

  • 0

In the following sample, when I type a new string into the TextBox and tab out the TextBlock is updated but the TextBox retains the value I typed in, instead being updated with the modified string. Any ideas how to change this behavior?

<Page
        x:Class="App1.MainPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="using:App1"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d">

        <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}" Margin="106,240,261,187">
            <StackPanel>
                <TextBox Text="{Binding MyProp, Mode=TwoWay}"/>
                <TextBlock Text="{Binding MyProp}"/>
            </StackPanel>
        </Grid>
    </Page>

public class ViewModel : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        public ViewModel()
        {
            MyProp = "asdf";
        }

        protected virtual void OnPropertyChanged(string propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
        }
        protected bool SetField<T>(ref T field, T value, string propertyName)
        {
            if (EqualityComparer<T>.Default.Equals(field, value)) return false;
            field = value;
            OnPropertyChanged(propertyName);
            return true;
        }

        private string m_myProp;

        public string MyProp
        {
            get { return m_myProp; }
            set
            {
                m_myProp = value + "1";
                OnPropertyChanged("MyProp");
            }
        }
    }
  • 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-15T09:08:39+00:00Added an answer on June 15, 2026 at 9:08 am

    The behavior you are seeing is somewhat the expected behavior.

    When you tab out of your TextBox, the binding calls the MyProp setter. When you call OnPropertyChanged() you are still in the context of the original binding and only the other bindings will be notified of the change. (To verify it, have a break point on the Getter and see that it is only hit once after the OnPropertyChanged is called. The solution to this is to call the OnPropertyChanged after the intial binding has finished updating and this is achieved by calling the method async and not awaiting for it to return.

    Replace the call to OnPropertyChanged(“MyProp”) with:

    Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, new 
    Windows.UI.Core.DispatchedHandler(() => { OnPropertyChanged("MyProp"); }));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the following sample, I build a query to do a bulk insert into
I have the following simple type: module Structures type Point2D<'T> (x : 'T, y
Consider my first attempt, a simple type in F# like the following: type Test()
i m having following type of simple sql server table Here I want to
Simple enough question I hope. I am using the following type of code to
I'm running a simple wordcount program, and I get the following error: Type mismatch
I have the following sample code and noticed that if I attempt to use
I wrote the following sample code to see how ARC works @property (nonatomic, weak)
I have the following sample code which doesn't seem to want to run. import
I have the following sample data: Id Name Quantity 1 Red 1 2 Red

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.