Files
2026-02-01 09:26:13 +03:00

207 lines
12 KiB
XML

<?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:controls="using:Lattice.UI"
xmlns:conv="using:Lattice.UI.Docking.WinUI.Converters"
xmlns:models="using:Lattice.Core.Docking.Models"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls">
<!-- 1. Шаблоны -->
<DataTemplate x:Key="LatticeGroupTemplate">
<controls:LatticeDockGroup />
</DataTemplate>
<DataTemplate x:Key="LatticeLeafTemplate">
<controls:LatticeDockLeaf />
</DataTemplate>
<!-- 2. Селектор -->
<conv:DockTemplateSelector x:Key="GlobalDockSelector"
GroupTemplate="{StaticResource LatticeGroupTemplate}"
LeafTemplate="{StaticResource LatticeLeafTemplate}" />
<!-- 3. Стиль Splitter -->
<Style TargetType="controls:LatticeSplitter">
<Setter Property="Background" Value="{ThemeResource Lattice.Brush.Splitter.Normal}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:LatticeSplitter">
<Grid Background="Transparent">
<Rectangle x:Name="SplitterRect"
Fill="{TemplateBinding Background}"
Width="{ThemeResource Lattice.Size.Splitter.Width}"
HorizontalAlignment="Center"/>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="PointerOver">
<Storyboard>
<ColorAnimation Storyboard.TargetName="SplitterRect"
Storyboard.TargetProperty="(Rectangle.Fill).(SolidColorBrush.Color)"
To="{ThemeResource Lattice.Color.Accent.Action}"
Duration="0:0:0.2"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 4. Стиль Host -->
<Style TargetType="controls:LatticeDockHost">
<Setter Property="Background" Value="{ThemeResource Lattice.Brush.Background.Primary}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:LatticeDockHost">
<Border Background="{TemplateBinding Background}"
Padding="4">
<ContentControl x:Name="PART_RootContainer"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 5. Стиль Group -->
<Style TargetType="controls:LatticeDockGroup">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:LatticeDockGroup">
<Grid x:Name="PART_Grid" Background="{TemplateBinding Background}">
<!-- First child area -->
<ContentControl x:Name="PART_First"
Content="{Binding First}"
ContentTemplateSelector="{StaticResource GlobalDockSelector}"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch" />
<!-- Splitter -->
<controls:LatticeSplitter x:Name="PART_Splitter"
Grid.Column="1"
Grid.Row="0"/>
<!-- Second child area -->
<ContentControl x:Name="PART_Second"
Content="{Binding Second}"
ContentTemplateSelector="{StaticResource GlobalDockSelector}"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 6. Стиль TabControl -->
<Style TargetType="controls:LatticeDockLeaf">
<Setter Property="Background" Value="{ThemeResource Lattice.Brush.Background.Primary}"/>
<Setter Property="BorderBrush" Value="{ThemeResource Lattice.Brush.Panel.Border}"/>
<Setter Property="BorderThickness" Value="{ThemeResource Lattice.BorderThickness.Panel}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:LatticeDockLeaf">
<Grid x:Name="PART_RootGrid" Background="{TemplateBinding Background}">
<!-- Tab headers -->
<ListBox x:Name="PART_TabHeaderList"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="0,0,0,1"
SelectionMode="Single"
HorizontalAlignment="Stretch">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderBrush" Value="{ThemeResource Lattice.Brush.Accent.Action}"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Margin" Value="0,0,4,0"/>
<Setter Property="Padding" Value="0"/>
<!-- Используем VisualStateManager вместо триггеров -->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="Selected">
<VisualState.Setters>
<Setter Target="Border.BorderThickness" Value="0,0,0,2"/>
<Setter Target="ContentPresenter.Foreground" Value="{ThemeResource Lattice.Brush.Accent.Action}"/>
</VisualState.Setters>
</VisualState>
<VisualState x:Name="PointerOver">
<VisualState.Setters>
<Setter Target="Border.Background" Value="{ThemeResource Lattice.Brush.Background.Secondary}"/>
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border x:Name="Border"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Margin="{TemplateBinding Margin}">
<ContentPresenter x:Name="ContentPresenter"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Padding="{TemplateBinding Padding}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
<!-- Tab content -->
<ContentControl x:Name="PART_ContentControl"
Background="{TemplateBinding Background}"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- 7. Ресурсы по умолчанию -->
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<!-- Цвета по умолчанию -->
<SolidColorBrush x:Key="Lattice.Brush.Background.Primary" Color="#1E1E1E" />
<SolidColorBrush x:Key="Lattice.Brush.Background.Secondary" Color="#252526" />
<SolidColorBrush x:Key="Lattice.Brush.Panel.Border" Color="#3F3F46" />
<SolidColorBrush x:Key="Lattice.Brush.Splitter.Normal" Color="#2D2D2D" />
<SolidColorBrush x:Key="Lattice.Brush.Accent.Action" Color="#007ACC" />
<SolidColorBrush x:Key="Lattice.Brush.Accent" Color="#007ACC" />
<SolidColorBrush x:Key="Lattice.Brush.Text.Primary" Color="#FFFFFF" />
<!-- Геометрия -->
<CornerRadius x:Key="Lattice.CornerRadius.Panel">4</CornerRadius>
<x:Double x:Key="Lattice.Size.Splitter.Width">6</x:Double>
<!-- Толщины -->
<Thickness x:Key="Lattice.BorderThickness.Panel">1</Thickness>
<Thickness x:Key="Lattice.Thickness.PanelMargin">2</Thickness>
<!-- Отступы -->
<x:Double x:Key="Lattice.Spacing.Panel">8</x:Double>
</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>