Files
Lattice/Lattice.UI.Docking.WinUI/Controls/LatticeDockLeaf.cs
2026-01-18 16:33:35 +03:00

40 lines
1.7 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using Lattice.Core.Docking.Models;
using Microsoft.UI.Xaml.Controls;
namespace Lattice.UI;
/// <summary>
/// Визуальное представление контейнера вкладок с поддержкой нижнего расположения.
/// </summary>
public class LatticeDockLeaf : Control
{
public LatticeDockLeaf()
{
this.DefaultStyleKey = typeof(LatticeDockLeaf);
}
protected override void OnApplyTemplate()
{
base.OnApplyTemplate();
UpdateTabPlacement();
}
/// <summary>
/// Настраивает внутреннюю структуру TabView для отображения вкладок снизу.
/// </summary>
private void UpdateTabPlacement()
{
var tabView = GetTemplateChild("PART_TabView") as TabView;
if (tabView == null || DataContext is not DockLeaf leaf) return;
// Вместо сложной манипуляции с визуальным деревом, используем встроенные свойства TabView
if (leaf.TabPlacement == TabPlacement.Bottom)
{
// К сожалению, TabView в WinUI не поддерживает TabStripPlacement
// Это ограничение платформы, нужно либо использовать другой контрол,
// либо реализовать кастомный TabControl с поддержкой нижнего расположения
// Временно оставляем как есть с заглушкой
System.Diagnostics.Debug.WriteLine("TabPlacement.Bottom is not fully supported in WinUI TabView");
}
}
}