static void CreateHandler(DependencyObject element, DependencyProperty property)
 {
     var focusMover = element.GetValue(FrameworkElement.DataContextProperty) as IFocusMover;
     if (focusMover == null)
     {
         var handler = element.GetValue(MoveFocusSinkProperty) as MoveFocusSink;
         if (handler != null)
         {
             handler.ReleaseReferences();
             element.ClearValue(MoveFocusSinkProperty);
         }
     }
     else
     {
         var handler = new MoveFocusSink(element as UIElement, property);
         focusMover.MoveFocus += handler.HandleMoveFocus;
         element.SetValue(MoveFocusSinkProperty, handler);
     }
 }
        static void CreateHandler(DependencyObject element, DependencyProperty property)
        {
            var focusMover = element.GetValue(FrameworkElement.DataContextProperty) as IFocusMover;

            if (focusMover == null)
            {
                var handler = element.GetValue(MoveFocusSinkProperty) as MoveFocusSink;
                if (handler != null)
                {
                    handler.ReleaseReferences();
                    element.ClearValue(MoveFocusSinkProperty);
                }
            }
            else
            {
                var handler = new MoveFocusSink(element as UIElement, property);
                focusMover.MoveFocus += handler.HandleMoveFocus;
                element.SetValue(MoveFocusSinkProperty, handler);
            }
        }