System.Windows.Controls.InteractionHelper.AllowMouseLeave C# (CSharp) Method

AllowMouseLeave() public method

Check if the control's MouseLeave event should be handled.
public AllowMouseLeave ( MouseEventArgs e ) : bool
e MouseEventArgs Event arguments.
return bool
        public bool AllowMouseLeave(MouseEventArgs e)
        {
            if(e == null)
            {
                throw new ArgumentNullException("e");
            }

            bool enabled = Control.IsEnabled;
            if(enabled)
            {
                IsMouseOver = false;
            }
            return enabled;
        }

Usage Example

 /// <summary>
 /// Provides handling for the MouseLeave event.
 /// </summary>
 /// <param name="e">The data for the event.</param>
 protected override void OnMouseLeave(MouseEventArgs e)
 {
     if (_interaction.AllowMouseLeave(e))
     {
         _interaction.OnMouseLeaveBase();
         base.OnMouseLeave(e);
     }
 }
All Usage Examples Of System.Windows.Controls.InteractionHelper::AllowMouseLeave