From d9e38e9ee6ea7c2de66a7121789472833a7c765d Mon Sep 17 00:00:00 2001
From: chr <chrry550@163.com>
Date: 星期四, 29 二月 2024 11:40:06 +0800
Subject: [PATCH] 优化UI样式;
---
Utils/CanvasHelper.cs | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/Utils/CanvasHelper.cs b/Utils/CanvasHelper.cs
index 6950430..246f2a4 100644
--- a/Utils/CanvasHelper.cs
+++ b/Utils/CanvasHelper.cs
@@ -10,22 +10,23 @@
{
public static void SetTopZIndex(InnerWindow element, DependencyObject parent, Type targetClass)
{
+ int max = 0;
+ int zindex = element.Zindex;
+
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++)
{
InnerWindow child = VisualTreeHelper.GetChild(parent, i) as InnerWindow;
if (child != null && targetClass == child.GetType())
{
- if (element == child)
+ if (element != child && child.Zindex >= zindex)
{
- child.Zindex = 1;
+ child.Zindex = child.Zindex-1;
}
- else
- {
- child.Zindex = 0;
- }
+
}
-
+ max++;
}
+ element.Zindex = max;
}
}
}
--
Gitblit v1.9.1