终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

31 rivejä
641 B

  1. using System.Windows.Controls;
  2. using System.Windows.Controls.Primitives;
  3. namespace BPASmartClient.MilkWithTea.Control;
  4. /// <summary>
  5. /// 带上下文菜单的切换按钮
  6. /// </summary>
  7. public class ContextMenuToggleButton : ToggleButton
  8. {
  9. public ContextMenu Menu { get; set; }
  10. protected override void OnClick()
  11. {
  12. base.OnClick();
  13. if (Menu != null)
  14. {
  15. if (IsChecked == true)
  16. {
  17. Menu.PlacementTarget = this;
  18. Menu.IsOpen = true;
  19. }
  20. else
  21. {
  22. Menu.IsOpen = false;
  23. }
  24. }
  25. }
  26. }