mirror of
https://gitee.com/akwkevin/aistudio.-wpf.-diagram
synced 2026-03-02 15:50:51 +08:00
40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using System.Windows.Data;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Media;
|
|
|
|
namespace AIStudio.Wpf.DiagramDesigner.Additionals.Converters
|
|
{
|
|
public class IndentConverter : IValueConverter
|
|
{
|
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
double colunwidth = 10;
|
|
double left = 0.0;
|
|
|
|
|
|
UIElement element = value as TreeViewItem;
|
|
while (element.GetType() != typeof(TreeView))
|
|
{
|
|
element = (UIElement)VisualTreeHelper.GetParent(element);
|
|
if (element.GetType() == typeof(TreeViewItem))
|
|
left += colunwidth;
|
|
}
|
|
return new Thickness(left, 0, 0, 0);
|
|
}
|
|
|
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
|
{
|
|
throw new NotImplementedException();
|
|
}
|
|
|
|
}
|
|
}
|