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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T07:15:44+00:00 2026-05-11T07:15:44+00:00

I apologize for the newbie question, but I am struggling with this problem. I

  • 0

I apologize for the newbie question, but I am struggling with this problem. I have the following TextBlock defined:

<TextBlock Text='{Binding Source={x:Static local:DeviceManager.Instance},  Path=Player.CurrentArtist}'></TextBlock> 

The DeviceManager is a singleton that functions as a facade for other classes. For example, Player is a property of type IPlayer which represents an music-playing application. I would like the TextBlock to display the artist that is currently playing, which is periodically updated in the Player.CurrentArtist property.

Unfortunately, I cannot get the TextBlock to update when the CurrentArtist property updates. Both the DeviceManager and the IPlayer implement INotifyPropertyChanged, but when I step through the application, the DeviceManager does not have an event handler attached to it.

Does anyone have a suggestion for how to update the text block while preserving the singleton-facade?

Here is the code for the INotifyPropertyChanged members in both the DeviceManager and the IPlayer subclass:

public sealed class DeviceManager : INotifyPropertyChanged {     // Singleton members omitted      public IPlayer Player     {         get { return player; }         set         {             this.player = value;             player.PropertyChanged += new PropertyChangedEventHandler(device_PropertyChanged);         }     }      #region INotifyPropertyChanged Members      public event PropertyChangedEventHandler PropertyChanged;      private void device_PropertyChanged(object sender, PropertyChangedEventArgs e)     {         PropertyChangedEventHandler handler = PropertyChanged;         if (handler != null)         {             handler(sender, e);         }     }      #endregion }  class MediaPlayer : IPlayer {     private string artist;     private string title;      public event PropertyChangedEventHandler PropertyChanged;      public void Play(string artist, string title)     {         this.artist = artist;         this.title = title;         OnPropertyChanged('Player:Song');     }      private void OnPropertyChanged(string p)     {         PropertyChangedEventHandler handler = PropertyChanged;         if (handler != null)         {             handler(this, new PropertyChangedEventArgs(p));         }     }      public string CurrentTitle     {         get { return title; }     }      public string CurrentArtist     {         get { return artist; }     }  } 
  • 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. 2026-05-11T07:15:45+00:00Added an answer on May 11, 2026 at 7:15 am

    The problem is that WPF is never notified of the value of the CurrentArtist property changing. You can either implement a private setter for the CurrentArtist property, which will trigger the PropertyChanged event, or trigger a PropertyChanged event for the CurrentArtist property in MediaPlayer.Play().

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

Sidebar

Related Questions

I apologize for this newbie question, but I'm looking for a simple solution. I
I apologize if this is a newbie question, but I cannot figure out why
I apologize if this is a newbie question. I have been working on trying
Apologies if this is a newbie question, but I have been unable to resolve
I'm pretty new to Maven, so I apologize if this is a newbie question.
I apologize in advance, if this question doesn't make sense. I'm a newbie. I
I apologize for the newb question but have not found a solution online. I
I apologize if the question is of the newbie level but I just started
I apologize in advance for the newbie nature of this question. Here is my
I'm a python newbie so I apologize in advance if this question has been

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.