Example #1
0
 /// <summary>
 /// Ensures that the selected control is removed (OnLeave) if it is a descendant of this control.
 /// </summary>
 /// <returns>True, if the focused control was nested in this control, otherwise false.</returns>
 public bool LeaveNestedFocusedControl()
 {
     if (IsAttached)
     {
         IContainer container = this as IContainer;
         if (container != null)
         {
             if (Container == null || Container.Host == null)
             {
                 return(false);
             }
             FluidControl selected = IsAttached ? Container.Host.FocusedControl : null;
             if (selected != null)
             {
                 if (container != null && selected.IsDescendantOf(container))
                 {
                     if (IsAttached)
                     {
                         Container.Host.FocusedControl = this.Selectable ? this : null;
                     }
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
Example #2
0
        /// <summary>
        /// Removes the focus of the selected control, if this control is a parent of the selected control.
        /// </summary>
        private void LeaveDescendant()
        {
            FluidControl selected = Container.Host.FocusedControl;

            if (selected != null)
            {
                if (selected.IsDescendantOf(this))
                {
                    Container.Host.FocusedControl = this;
                }
            }
        }