I\'m trying to bind a static property of some class to some control. I\'ve tryied a few implementation but each has its problem:
All examples use the next XAML:
I'd suggest you just have an instance-property return your static property like this:
private static string _text;
public string text
{
get { return _text; }
set
{
_text = value;
OnPropertyChanged("text");
}
}
However this makes the whole binding comparatively pointless since change notifications are only created in one instance of the class and not every instance. Thus only bindings which bind to the property on the specific instance on which it was changed will update.
A better method would be using a singleton as can be seen here.