protected UserControl GetContainingScreen() { var userControlAncestors = this.AssociatedObject.GetSelfAndAncestors().OfType <UserControl>(); // Find the first screen up the visual tree, so that we can invoke state on the proper UserControl var screen = userControlAncestors.FirstOrDefault(userControl => InteractionContext.IsScreen(userControl.GetType().FullName)); // If we couldn't find a hosting screen, take the first UserControl we find. return(screen ?? userControlAncestors.First()); }