I have a class of objects with complex values ββthat has 1) a number or read-only properties; 2) private constructor; and 3) the number of static properties of the singleton instance [so the properties of the ComplexValueObject never change, and an individual value is created once in the application life cycle].
public class ComplexValueClass { private readonly string _propertyOne; public string PropertyOne { get { return _propertyOne; } } private readonly string _propertyTwo; public string PropertyTwo { get { return _propertyTwo; } } private ComplexValueClass(string propertyOne, string propertyTwo) { _propertyOne = propertyOne; _propertyTwo = PropertyTwo; } private static ComplexValueClass _complexValueObjectOne; public static ComplexValueClass ComplexValueObjectOne { get { if (_complexValueObjectOne == null) { _complexValueObjectOne = new ComplexValueClass("string one", "string two"); } return _complexValueObjectOne; } } private static ComplexValueClass _complexValueObjectTwo; public static ComplexValueClass ComplexValueObjectTwo { get { if (_complexValueObjectTwo == null) { _complexValueObjectTwo = new ComplexValueClass("string three", "string four"); } return _complexValueObjectTwo; } } }
I have a data context class that looks something like this:
public class DataContextClass : INotifyPropertyChanged { private ComplexValueClass _complexValueClass; public ComplexValueClass ComplexValueObject { get { return _complexValueClass; } set { _complexValueClass = value; PropertyChanged(this, new PropertyChangedEventArgs("ComplexValueObject")); } } }
I would like to write a XAML binding instruction for a property on my complex value object that updates the user interface whenever the entire complex value object changes. What is the best and / or most concise way to do this? I have something like:
<Object Value="{Binding ComplexValueObject.PropertyOne}" />
but the user interface is not updated when ComplexValueObject changes as a whole.
source share