// TODO fiure out a way to call this async and still maintain order // maybe blocking collection + cancellationtokensource private void UpdateDataContext() { if (Content == null || !IsSelected || GetDataContext == null) { return; } // while fetching the dataconext, we will switch IsBusy accordingly using (var token = BusyStack.GetToken()) { var currentContext = Content.DataContext as ObservableObject; var newContext = GetDataContext.Invoke(); if (currentContext == null && newContext == null) { return; } if (EqualityComparer <ObservableObject> .Default.Equals(currentContext, newContext)) { return; } Content.DataContext = newContext; } }