Skip to content

Commit

Permalink
Open submenus on hover
Browse files Browse the repository at this point in the history
  • Loading branch information
bcssov committed May 12, 2023
1 parent 0f679df commit 24fa914
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/IronyModManager/Controls/VerticalMenuItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
using System.Linq;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
using Avalonia.Input;
using Avalonia.LogicalTree;
using Avalonia.Styling;

namespace IronyModManager.Controls
Expand Down Expand Up @@ -66,6 +68,24 @@ protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
}
}

/// <summary>
/// Handles the <see cref="E:PointerEnter" /> event.
/// </summary>
/// <param name="e">The <see cref="PointerEventArgs"/> instance containing the event data.</param>
/// <inheritdoc />
protected override void OnPointerEnter(PointerEventArgs e)
{
base.OnPointerEnter(e);
if (IsPointerOver)
{
var hasChildren = this.GetLogicalChildren().OfType<MenuItem>().Any();
if (hasChildren)
{
Open();
}
}
}

#endregion Methods
}
}

0 comments on commit 24fa914

Please sign in to comment.