public static class FrameworkElementExt
  {
    public static void BringToFront(this FrameworkElement element)
    {
      if (element == null) return;

      Panel parent = element.Parent as Panel;
      if (parent == null) return;

      var maxZ = parent.Children.OfType<UIElement>()
        .Where(x => x != element)
        .Select(x => Panel.GetZIndex(x))
        .Max();
      Panel.SetZIndex(element, maxZ + 1);
    }
  }

相关文章:

  • 2021-05-19
  • 2022-01-01
  • 2021-06-17
  • 2022-02-13
  • 2021-08-21
  • 2021-09-12
  • 2021-10-06
  • 2021-10-24
猜你喜欢
  • 2021-09-03
  • 2022-12-23
  • 2021-09-06
  • 2022-12-23
  • 2021-06-08
  • 2021-11-06
  • 2022-01-01
相关资源
相似解决方案