I have a partial class to extend one of my LinqToSql classes. In this partial class I have the following calculated field.
public bool IsInCluster
{
get
{
return Cluster != null;
}
}
In order for a grid column databound to this field to update automatically I have implemented the following partial method.
partial void OnClusterIDChanged() { SendPropertyChanged("IsInCluster"); }
However when I update the Cluster property as shown in the following code the OnClusterIDChanged method does not get called:
private void ExecCreateClusterCommand()
{var cluster = new Cluster() { ID = Guid.NewGuid(), MailService = AppState.CurrentMailService }; App.DataContext.Clusters.InsertOnSubmit(cluster); foreach (DeliveryPoint deliveryPoint in SelectedDeliveryPoints) { deliveryPoint.Cluster = cluster; } App.DataContext.SubmitChanges();}
I have successfully used this technique with other non navigation properties related to calculated fields. Is there a way to make this work?
The only solution I could find for this was to create a public method in the DeliveryPoint class enabling me to call SendPropertyChanged for the required field (navigation property):