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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:41:55+00:00 2026-06-18T01:41:55+00:00

I have a client server application. From the server I get a simple data

  • 0

I have a client server application.
From the server I get a simple data transfer object.
e.g.

public class Person:BaseObject
{
  public string Name { get; set; }

  public string Course { get; set; }

  public Person( string name )
  {
    this.Name = name;
  }
}

On the client side I have a WPF application and so i have to use INotifyPropertyChanged.
Now i look for a elegant way to implement this in my object. My advantage is that the most dialogs are only displaying, so that there is no reason to implement it there, because in these cases the whole object will be switch (For that i use INotifyPropertyChanged in my ViewModel which contains the object). Now i have situation where a property get changed in a deeper structure and my view didn’t notice it.

I try to solve it with a inheritance and a extension.
I wrote my “own” class.

public class PersonCm : Person
{
    public new string Course
    {
      get
      {
        return base.Course;
      }
      set
      {
        base.Course = value;
        this.PropertyChanged( );
      }
}

So i got all Property from my base class and “override” only these where i need my INotifyPropertyChanged. To add my functionality i use following two classes:

public class ClientFunctions : INotifyPropertyChanged
{
    public static readonly ClientFunctions Instance = new ClientFunctions( );

    private ClientFunctions( )
    {
      // Empty
    }

    [field: NonSerialized]
    public event PropertyChangedEventHandler PropertyChanged;

    public bool SetProperty<T>( ref T storage, T value, [CallerMemberName] string propertyName = "" )
    {
      if ( object.Equals( storage, value ) )
      {
        return false;
      }

      storage = value;
      this.OnPropertyChanged( propertyName, storage );
      return true;
    }

    public void OnPropertyChanged( string propertyName, object sender )
    {

      var eventHandler = this.PropertyChanged;
      if ( eventHandler != null )
      {
        eventHandler( this, new PropertyChangedEventArgs( propertyName ) );
      }
    }
}

A singleton class with the INotifyPropertyChanged code.

 public static class Extension
 {
   public static void PropertyChanged( this BaseObject obj, [CallerMemberName] string propertyName = "" )
   {
    ClientFunctions.Instance.OnPropertyChanged( propertyName, obj );
   }
}

And one Extension which call my singleton class.

My problem now is that each time i call my INotifyPropertyChanged code my PropertyChangedEventHandler is null and i have no idea why.

Does anybody have an idea or an tip for me.

  • 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-18T01:41:57+00:00Added an answer on June 18, 2026 at 1:41 am

    From what I can see you have an object (your PersonCm) with a property, but when its property changes, the extension method causes the ClientFunctions.Instance object to raise a PropertyChanged event. That PropertyChanged will only be subscribed if you’re binding to a property on that ClientFunctions.Instance object. The object containing your property must surely implement INotifyPropertyChanged itself with its own PropertyChanged event (eg by inheriting a base class).

    (PropertyChanged will be null if there are no subscribers to that event – i.e. nothing is binding to any property on the object.)

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

Sidebar

Related Questions

I have a server application receiving messages from a JMS queue. And client applications
I have a server application that receives some special TCP packet from a client
I have client/server application where the client app will open files. Those files get
I have a client/server application where data is exchanged in XML format. The size
I'm trying to get a simple GXT application to retrieve data from an external
I have Rails application that needs to retrieve data from a SOAP server outside
I have some client-server application. And as one of its part, I need to
I have a Client/Server application, where the Client and Server have some common tables
I have a client server application in which the server and the client need
I have a client - server application, where I want to add a exception

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.