using System;
|
using System.Windows;
|
using System.Windows.Controls;
|
using System.Windows.Media;
|
|
namespace WPFProject.Utils
|
{
|
public class CanvasHelper
|
{
|
public static void SetTopZIndex(object element, DependencyObject parent, Type targetClass)
|
{
|
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++)
|
{
|
UIElement child = VisualTreeHelper.GetChild(parent, i) as UIElement;
|
if (child != null && targetClass == child.GetType())
|
{
|
if (element == child)
|
{
|
Canvas.SetZIndex(child, 1);
|
}
|
else
|
{
|
Canvas.SetZIndex(child, 0);
|
}
|
}
|
|
}
|
}
|
}
|
}
|