chenghaoran
2024-02-21 3b877b5501c3c0e4ccb7e4cfd37ddae60f670e4f
Utils/CanvasHelper.cs
@@ -2,25 +2,26 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using WPFProject.Controls;
namespace WPFProject.Utils
{
    public class CanvasHelper
    {
        public static void SetTopZIndex(object element, DependencyObject parent, Type targetClass)
        public static void SetTopZIndex(InnerWindow element, DependencyObject parent, Type targetClass)
        {
            for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++)
            {
                UIElement child = VisualTreeHelper.GetChild(parent, i) as UIElement;
                InnerWindow child = VisualTreeHelper.GetChild(parent, i) as InnerWindow;
                if (child != null && targetClass == child.GetType())
                {
                    if (element == child)
                    {
                        Canvas.SetZIndex(child, 1);
                        child.Zindex = 1;
                    }
                    else
                    {
                        Canvas.SetZIndex(child, 0);
                        child.Zindex = 0;
                    }
                }