using System.Windows.Controls; namespace HandyControl.Controls; /// /// 带上下文菜单的按钮 /// public class ContextMenuButton : Button { public ContextMenu Menu { get; set; } protected override void OnClick() { base.OnClick(); if (Menu != null) { Menu.PlacementTarget = this; Menu.IsOpen = true; } } }