示例#1
0
 protected void HandleScheduledFocus()
 {
     if (_scheduledFocus.Count == 0)
     {
         // Shortcut
         return;
     }
     for (SetFocusPriority prio = SetFocusPriority.Highest; prio != SetFocusPriority.None; prio--)
     {
         ScheduledFocus sf;
         if (_scheduledFocus.TryGetValue(prio, out sf))
         {
             if (sf.FocusElement.TrySetFocus(true))
             {
                 // Remove all lower focus priority requests
                 for (SetFocusPriority removePrio = prio; removePrio != SetFocusPriority.None; removePrio--)
                 {
                     _scheduledFocus.Remove(removePrio);
                 }
             }
             else if (sf.IncAge() > MAX_SET_FOCUS_AGE)
             {
                 _scheduledFocus.Remove(prio);
             }
         }
     }
 }
示例#2
0
 public void ScheduleSetFocus(FrameworkElement element, SetFocusPriority setFocusPriority)
 {
     if (_scheduledFocus.ContainsKey(setFocusPriority))
     {
         return;
     }
     _scheduledFocus[setFocusPriority] = new ScheduledFocus(element);
 }
示例#3
0
 protected void UpdateFocus()
 {
   if (_setFocusPrio == SetFocusPriority.None)
     return;
   Screen screen = Screen;
   if (screen == null)
     return;
   screen.ScheduleSetFocus(this, _setFocusPrio);
   _setFocusPrio = SetFocusPriority.None;
 }
示例#4
0
    public override void DeepCopy(IDeepCopyable source, ICopyManager copyManager)
    {
      Detach();
      object oldLayoutTransform = LayoutTransform;
      base.DeepCopy(source, copyManager);
      FrameworkElement fe = (FrameworkElement) source;
      Width = fe.Width;
      Height = fe.Height;
      Style = copyManager.GetCopy(fe.Style);
      ActualWidth = fe.ActualWidth;
      ActualHeight = fe.ActualHeight;
      HorizontalAlignment = fe.HorizontalAlignment;
      VerticalAlignment = fe.VerticalAlignment;
      Focusable = fe.Focusable;
      FontSize = fe.FontSize;
      FontFamily = fe.FontFamily;
      MinWidth = fe.MinWidth;
      MinHeight = fe.MinHeight;
      MaxWidth = fe.MaxWidth;
      MaxHeight = fe.MaxHeight;
      _setFocusPrio = fe.SetFocusPrio;
      _renderedBoundingBox = null;

      ContextMenuCommand = copyManager.GetCopy(fe.ContextMenuCommand);

      // Need to manually call this because we are in a detached state
      OnLayoutTransformPropertyChanged(_layoutTransformProperty, oldLayoutTransform);

      Attach();
    }