I have an MVVM ViewModel which loads an EF object as part of the constructor, and then exposes that object as a property. The UI can then update depending on the properties of that object. So far so easy.
The UI has two date elements, handled with datepickers. When one changes, I want to examine the status of the other and possibly alert the user with a popup. So I created a "DateCheck" property on my ViewModel and bound the IsOpen property of the PopUp to that:
public bool Check
{
get
{
if (Job.ExtractDate != null && Job.DeliveryDate == null)
{
return true;
}
else
{
return false;
}
}
}
This should work in theory, but I can't figure out how to get it to trigger.
If I set the UpdateSourceTrigger of the binding to LostFocus, it never triggers because the binding is on the popup itself - it's not visible, so of course it can't lose focus.
If I set the UpdateSource trigger to PropertyChanged then I need to raise the change event somehow. But the property that's being changed isn't on the ViewModel itself - it's on the source object that the ViewModel is exposing as a property.
Certainly I'm missing something fundamental here and am being very stupid. How can I trigger my property change?