Forge
csharpdeeb25a2
1using Avalonia.Controls;
2
3namespace CascadeIDE.Features.Workspace.Application;
4
5/// <summary>Фиксированный горизонтальный отступ узлов SE (ADR 0167 §2.5).</summary>
6public static class SolutionExplorerTreeIndent
7{
8 public const double StepPixels = 17;
9
10 public static int GetDepth(TreeViewItem item)
11 {
12 var depth = 0;
13 var parent = item.Parent;
14 while (parent is not null)
15 {
16 if (parent is TreeViewItem)
17 depth++;
18 parent = parent.Parent;
19 }
20
21 return depth;
22 }
23
24 public static void Apply(TreeViewItem item)
25 {
26 var depth = GetDepth(item);
27 item.Padding = new Avalonia.Thickness(2, 2);
28 item.Margin = new Avalonia.Thickness(depth * StepPixels, 0, 0, 0);
29 }
30}
31
View only · write via MCP/CIDE