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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:32:35+00:00 2026-06-10T18:32:35+00:00

I have a simple wpf checkbox <CheckBox Name=layerCheckBox IsChecked={Binding Path=IsSelected, Mode=TwoWay} Grid.Column=0 /> which

  • 0

I have a simple wpf checkbox

 <CheckBox Name="layerCheckBox" IsChecked="{Binding Path=IsSelected, Mode=TwoWay}" Grid.Column="0" />

which I bind to a BindingList of my custom Layer class.

 public BindingList<Layer> Layer
    {
        get { return _layer; }
        set { _layer = value; }
    }

The Layer class has a property IsSelected. Thats what I use in my checkbox. As you can see I added some output for reading and writing the property

public bool IsSelected 
{

 get
 {
   System.Diagnostics.Debug.WriteLine("get"+_isSelected+this.GetHashCode()+
     "thread"+Thread.CurrentThread.ManagedThreadId); 
   return _isSelected; 
 }

 set 
 { 
   System.Diagnostics.Debug.WriteLine("set" + value + this.GetHashCode() 
     + "thread" + Thread.CurrentThread.ManagedThreadId);
   PropertyChanged.ChangeAndNotify(ref _isSelected, value, () => IsSelected); 
 }
}

The weird thing is the output. First of all I check the checkbox and the property is set to true. Afterwards I read the property and it says false? Whats going on? Its the same object (hashcode) and the same thread… I don’t get it… And for the next 2 reads, I guess that the refresh, it is true again. The best part is – if I uncheck the box it returns true.

The code inside the property is from here property notify

the output

setTrue53182860thread1

getFalse53182860thread1

getTrue53182860thread1

getTrue53182860thread1

  • 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-10T18:32:37+00:00Added an answer on June 10, 2026 at 6:32 pm

    What might be the issue is the ChangeAndNotify extension method. It sets the value of your field after the raising of the property changed event.

    When you raise the event all subscribers will attempt to read from the property. Because the backing field has not been set yet it will return the original value.

    Fix the code in the ChangeAndNotify extension method to set the value of the field before the raising of the Property Change event.

    field = value;   //<-- move to here
    if (vmExpression != null)
    {
        LambdaExpression lambda = Expression.Lambda(vmExpression);
        Delegate vmFunc = lambda.Compile();
        object sender = vmFunc.DynamicInvoke();
    
        if( handler != null)
        {
            handler(sender, new PropertyChangedEventArgs(body.Member.Name));
        }
    }
    
    return true;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very simple WPF application in which I am using data binding
Say I have a very simple WPF grid (6 rows x 6 columns) defined
I have a VERY simple 3D space defined in WPF, which defines a 3D
I have written a simple WPF application in which I wanted to test the
I have a simple wpf app which has a button that increments a value
I have some simple WPF with a MediaElement which is, generally, working. I have
It is about WPF application which generates reports. Reports have simple structure: byte[] m_Data,
I have a simple WPF application which I am trying to start. I am
I have a simple WPF application I'm working on, which performs a SQL query
I have a very simple WPF application which displays a ComboBox which binds to

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.