Доработан Docking

This commit is contained in:
2026-01-27 05:17:35 +03:00
parent 33abd94f6e
commit 584df249f6
99 changed files with 2270 additions and 12792 deletions

View File

@@ -34,21 +34,16 @@ public static class DockUtilities
var control = factory.CreateControlForElement(element);
if (control == null) return null;
// Устанавливаем родительский контрол
if (parentControl != null)
{
// Здесь может быть установка дополнительных связей
}
// Рекурсивно создаем дочерние контролы
if (element is DockGroup group)
if (element is DockGroup group && control is IDockGroupControl groupControl)
{
if (control is IDockGroupControl groupControl)
{
var firstChild = CreateControlForElement(group.First, factory, control);
var secondChild = CreateControlForElement(group.Second, factory, control);
groupControl.SetChildren(firstChild, secondChild);
}
var firstChild = CreateControlForElement(group.First, factory, control);
var secondChild = CreateControlForElement(group.Second, factory, control);
groupControl.SetChildren(firstChild, secondChild);
}
return control;
@@ -57,10 +52,9 @@ public static class DockUtilities
/// <summary>
/// Находит контрол для указанного элемента в дереве контролов.
/// </summary>
public static IDockControl? FindControlForElement(IDockControl root, IDockElement element)
public static IDockControl? FindControlForElement(IDockControl? root, IDockElement element)
{
if (root == null) throw new ArgumentNullException(nameof(root));
if (element == null) throw new ArgumentNullException(nameof(element));
if (root == null || element == null) return null;
if (root.Model?.Id == element.Id)
return root;
@@ -88,6 +82,5 @@ public static class DockUtilities
if (factory == null) throw new ArgumentNullException(nameof(factory));
// TODO: Реализовать эффективное обновление дерева контролов
// вместо полной перестройки
}
}