class ParentUserControl { public void ChangeContent(UIElement newContent) { var userControl = newContent as IBaseUserControl; if (userControl == null) { throw new NoNullAllowedException(); } if (GridControl.Children.Count == 0) { GridControl.Children.Add(newContent); userControl.GetObservableCollection(); } else { GridControl.IsHitTestVisible = false; var oldContent = GridControl.Children[0]; EventHandler onAnimationCompletedHandler = delegate { GridControl.IsHitTestVisible = true; GridControl.Children.Remove(oldContent); userControl.GetObservableCollection(); }; FadeAnimation(newContent, oldContent, onAnimationCompletedHandler); } // None of these work //GridControl.Focus(); //newContent.Focus(); //Keyboard.Focus(newContent); Keyboard.Focus(GridControl); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)