Exemple #1
0
        public override void FocusOutHandler(Event e)
        {
            FocusEvent fe = (FocusEvent)e;

            if (IsOurFocus((DisplayObject)e.Target))
            {
                DropDownController.ProcessFocusOut(e);
            }

            base.FocusOutHandler(e);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        public void ProcessFocusOut(Event e)
        {
            FocusEvent fe = (FocusEvent)e;

            // Note: event.relatedObject is the object getting focus.
            // It can be null in some cases, such as when you open
            // the dropdown and then click outside the application.

            // If the dropdown is open...
            if (IsOpen)
            {
                // If focus is moving outside the dropdown...
                if (null == fe.RelatedObject ||
                    (null == DropDown ||
                     (DropDown is DisplayObjectContainer &&
                      !((DisplayObjectContainer)DropDown).Contains(fe.RelatedObject))))
                {
                    // Close the dropdown.
                    CloseDropDown(true);
                }
            }
        }