PropertyChanged in nested Model

Topics: Questions
Oct 1, 2014 at 9:31 AM

Little Question

In my model I have a nested other model. If a property is changed in the parentmodel the view is updated. If a property is changed in the child model the view is not updated.

How to solve such a problem. Is there a solution in catel?
Oct 2, 2014 at 6:10 AM
Completely depends on how you are using this in xaml. If the model supports INotifyPropertyChanged, it should automatically be visible in the UI (if you are binding directly to it). Otherwise you might be interested in the OnPropertyObjectPropertyChanged method on ModelBase.
Oct 6, 2014 at 1:50 PM

Nested Model supports INotifyPropertyChanged:
public class Place : ModelBase
   public Probe Probe
        get { return GetValue<Probe>(ProbeProperty); }
        set { SetValue(ProbeProperty, value); }

   public static readonly PropertyData ProbeProperty = RegisterProperty("Probe", typeof (Probe));

public class Probe : ModelBase
    public MeasurementData LastMeasurementData
        get { return GetValue<MeasurementData>(LastMeasurementDataProperty); }
        private set { SetValue(LastMeasurementDataProperty, value); }

   public static readonly PropertyData LastMeasurementDataProperty = RegisterProperty("LastMeasurementData", typeof (MeasurementData));

Content ="{Binding Probe.LastMeasurementData.Value}"

LastMeasurementData throws PropertyChanged. But the Content is not refreshed.