Добавлен проект UI

This commit is contained in:
2026-01-07 22:33:42 +03:00
parent b6de0543b7
commit ca5d912c9c
21 changed files with 1188 additions and 4 deletions

View File

@@ -0,0 +1,16 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Lattice.UI.Controls">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///Lattice.UI/Themes/Styles/SharedResources.xaml" />
<!-- Порядок важен: сначала базовые ресурсы, потом стили контролов -->
<ResourceDictionary Source="ms-appx:///Lattice.UI/Themes/Styles/LatticeDockHost.xaml" />
<ResourceDictionary Source="ms-appx:///Lattice.UI/Themes/Styles/LatticePane.xaml" />
<ResourceDictionary Source="ms-appx:///Lattice.UI/Themes/Styles/LatticeSplitter.xaml" />
<ResourceDictionary Source="ms-appx:///Lattice.UI/Themes/Styles/DockAnchorOverlay.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

View File

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Lattice.UI.Primitives">
<Style TargetType="local:DockAnchorOverlay">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:DockAnchorOverlay">
<Canvas x:Name="OverlayCanvas" Background="Transparent">
<!-- Центральный "ромб" с кнопками направлений -->
<Grid x:Name="AnchorGroup" Width="120" Height="120">
<!-- Используем Acrylic или Mica Alt для стиля 2026 -->
<Rectangle Fill="{ThemeResource SystemControlAcrylicElementBrush}"
RadiusX="4" RadiusY="4" Opacity="0.8"/>
<!-- Кнопки-иконки (Left, Right, Top, Bottom, Center) -->
<FontIcon Glyph="&#xE76B;" VerticalAlignment="Top"/>
<!-- Top -->
<FontIcon Glyph="&#xE76C;" HorizontalAlignment="Left"/>
<!-- Left -->
<FontIcon Glyph="&#xE76D;" HorizontalAlignment="Right"/>
<!-- Right -->
<FontIcon Glyph="&#xE76E;" VerticalAlignment="Bottom"/>
<!-- Bottom -->
<FontIcon Glyph="&#xE72D;" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<!-- Center -->
</Grid>
<!-- Превью зоны (синий полупрозрачный прямоугольник) -->
<Rectangle x:Name="DropPreview" Fill="{ThemeResource SystemAccentColorLight3}"
Opacity="0.4" Visibility="Collapsed"/>
</Canvas>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Lattice.UI.Controls"
xmlns:primitives="using:Lattice.UI.Primitives">
<Style TargetType="local:LatticeDockHost">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:LatticeDockHost">
<!-- Используем Grid, чтобы наложить оверлей ПОВЕРХ контента -->
<Grid x:Name="RootGrid" Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<!-- 1. Основной слой: Сюда программно рендерятся панели через LayoutPanel -->
<ContentPresenter x:Name="LayoutPresenter"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch" />
<!-- 2. Слой подсказок: Должен быть ниже в списке, чтобы быть выше визуально -->
<!-- Обязательно x:Name="AnchorOverlay", так как C# ищет его по этому имени -->
<primitives:DockAnchorOverlay x:Name="AnchorOverlay"
Visibility="Collapsed"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
IsHitTestVisible="False" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

View File

@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Lattice.UI.Controls">
<Style TargetType="local:LatticePane">
<!-- Используем StaticResource, так как эти токены определены в нашем SharedResources -->
<Setter Property="Background" Value="{StaticResource LatticePaneBackground}" />
<Setter Property="BorderBrush" Value="{StaticResource LatticePaneBorderBrush}" />
<Setter Property="BorderThickness" Value="{StaticResource LatticePaneMargin}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:LatticePane">
<Grid Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{StaticResource LatticePaneCornerRadius}">
<Grid.RowDefinitions>
<!-- Используем токен высоты заголовка -->
<RowDefinition Height="Auto" MinHeight="{StaticResource LatticePaneHeaderHeight}" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<!-- Заголовок панели -->
<Grid x:Name="HeaderPresenter"
Background="{StaticResource LatticePaneHeaderBackground}"
Padding="8,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock Text="{TemplateBinding Title}"
VerticalAlignment="Center"
Style="{ThemeResource CaptionTextBlockStyle}"
MaxLines="1"
TextTrimming="CharacterEllipsis"/>
<StackPanel Orientation="Horizontal" Grid.Column="1" VerticalAlignment="Center">
<!-- Кастомный контент (кнопки пользователя) -->
<ContentPresenter Content="{TemplateBinding HeaderContent}" />
<!-- Стандартная кнопка закрытия -->
<!-- Используем стандартный стиль WinUI "отсутствие рамки", чтобы она выглядела как в VS -->
<Button x:Name="PART_CloseButton"
Content="&#xE8BB;"
FontFamily="Segoe Fluent Icons"
FontSize="10"
Padding="8,4"
Background="Transparent"
BorderThickness="0"
Style="{StaticResource DefaultButtonStyle}" />
</StackPanel>
</Grid>
<!-- Основной контент -->
<ContentPresenter Grid.Row="1"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:Lattice.UI.Controls">
<Style TargetType="local:LatticeSplitter">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:LatticeSplitter">
<Grid Background="{TemplateBinding Background}">
<!-- PART_Thumb — это невидимая или тонкая область, которую тянет пользователь -->
<Thumb x:Name="PART_Thumb">
<Thumb.Template>
<ControlTemplate TargetType="Thumb">
<Grid Background="Transparent">
<!-- Визуальная линия разделителя -->
<Rectangle Fill="{ThemeResource SystemControlForegroundBaseLowBrush}"
MinWidth="1" MinHeight="1" HorizontalAlignment="Center"/>
</Grid>
</ControlTemplate>
</Thumb.Template>
</Thumb>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<!-- Размеры (Tokens) -->
<x:Double x:Key="LatticeSplitterThickness">4.0</x:Double>
<x:Double x:Key="LatticePaneHeaderHeight">32.0</x:Double>
<CornerRadius x:Key="LatticePaneCornerRadius">4</CornerRadius>
<Thickness x:Key="LatticePaneMargin">1</Thickness>
<!-- Акцентный цвет (статичный токен) -->
<SolidColorBrush x:Key="LatticeActiveHeaderBrush" Color="{ThemeResource SystemAccentColor}"/>
<!-- Правильная привязка системных кистей для поддержки смены тем (Dark/Light) -->
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Default">
<StaticResource x:Key="LatticePaneBackground" ResourceKey="LayerFillColorDefaultBrush"/>
<StaticResource x:Key="LatticePaneBorderBrush" ResourceKey="CardStrokeColorDefaultBrush"/>
<StaticResource x:Key="LatticePaneHeaderBackground" ResourceKey="LayerOnSecondaryFillColorDefaultBrush"/>
</ResourceDictionary>
<!-- Можно добавить специфические правки для HighContrast, если нужно -->
</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>