195 lines
11 KiB
XML
195 lines
11 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">
|
||
|
||
<!-- 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. Стиль Сплиттера -->
|
||
<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 Fill="{TemplateBinding Background}"
|
||
Width="{ThemeResource Lattice.Size.SplitterWidth}"
|
||
HorizontalAlignment="Center"/>
|
||
</Grid>
|
||
</ControlTemplate>
|
||
</Setter.Value>
|
||
</Setter>
|
||
</Style>
|
||
|
||
<!-- 4. Стиль Хоста -->
|
||
<Style TargetType="controls:LatticeDockHost">
|
||
<Setter Property="Template">
|
||
<Setter.Value>
|
||
<ControlTemplate TargetType="controls:LatticeDockHost">
|
||
<ContentControl
|
||
Content="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Manager.Root}"
|
||
ContentTemplateSelector="{StaticResource GlobalDockSelector}"
|
||
HorizontalContentAlignment="Stretch"
|
||
VerticalContentAlignment="Stretch" />
|
||
</ControlTemplate>
|
||
</Setter.Value>
|
||
</Setter>
|
||
</Style>
|
||
|
||
<!-- 5. Стиль Группы (Рекурсия) -->
|
||
<Style TargetType="controls:LatticeDockGroup">
|
||
<Setter Property="Template">
|
||
<Setter.Value>
|
||
<ControlTemplate TargetType="controls:LatticeDockGroup">
|
||
<!-- Grid перестраивается в коде LatticeDockGroup.cs -->
|
||
<Grid x:Name="PART_Grid">
|
||
<!-- Первая область -->
|
||
<ContentControl x:Name="PART_First"
|
||
Content="{Binding First}"
|
||
ContentTemplateSelector="{StaticResource GlobalDockSelector}"
|
||
HorizontalContentAlignment="Stretch"
|
||
VerticalContentAlignment="Stretch" />
|
||
|
||
<!-- Сплиттер (его положение в Grid.Row/Column устанавливается автоматически при перестроении Grid) -->
|
||
<controls:LatticeSplitter x:Name="PART_Splitter" />
|
||
|
||
<!-- Вторая область -->
|
||
<ContentControl x:Name="PART_Second"
|
||
Content="{Binding Second}"
|
||
ContentTemplateSelector="{StaticResource GlobalDockSelector}"
|
||
HorizontalContentAlignment="Stretch"
|
||
VerticalContentAlignment="Stretch" />
|
||
</Grid>
|
||
</ControlTemplate>
|
||
</Setter.Value>
|
||
</Setter>
|
||
</Style>
|
||
|
||
<!-- 6. Стиль Листа -->
|
||
<Style TargetType="controls:LatticeDockLeaf">
|
||
<Setter Property="VerticalContentAlignment" Value="Stretch" />
|
||
<Setter Property="Template">
|
||
<Setter.Value>
|
||
<ControlTemplate TargetType="controls:LatticeDockLeaf">
|
||
<!-- Grid и Border должны растягиваться -->
|
||
<Grid Margin="{ThemeResource Lattice.Thickness.PanelMargin}" VerticalAlignment="Stretch">
|
||
<Border Background="{ThemeResource Lattice.Brush.Background.Primary}"
|
||
BorderBrush="{ThemeResource Lattice.Brush.Panel.Border}"
|
||
BorderThickness="{ThemeResource Lattice.Thickness.PanelBorder}"
|
||
CornerRadius="{ThemeResource Lattice.Geometry.PanelCornerRadius}"
|
||
VerticalAlignment="Stretch">
|
||
|
||
<!-- Используем кастомный TabControl или оставляем стандартный -->
|
||
<TabView x:Name="PART_TabView"
|
||
TabItemsSource="{Binding Children}"
|
||
SelectedItem="{Binding ActiveContent, Mode=TwoWay}"
|
||
IsAddTabButtonVisible="False"
|
||
VerticalAlignment="Stretch"
|
||
VerticalContentAlignment="Stretch"
|
||
TabWidthMode="SizeToContent"
|
||
Padding="0">
|
||
|
||
<TabView.TabItemTemplate>
|
||
<DataTemplate>
|
||
<TabViewItem Header="{Binding Title}" FontSize="11" Height="28" MinWidth="0" >
|
||
<!-- ContentPresenter ДОЛЖЕН иметь VerticalAlignment="Stretch" -->
|
||
<ContentPresenter Content="{Binding View}"
|
||
HorizontalAlignment="Stretch"
|
||
VerticalAlignment="Stretch" />
|
||
</TabViewItem>
|
||
</DataTemplate>
|
||
</TabView.TabItemTemplate>
|
||
</TabView>
|
||
</Border>
|
||
</Grid>
|
||
</ControlTemplate>
|
||
</Setter.Value>
|
||
</Setter>
|
||
</Style>
|
||
|
||
<!-- Добавить в Generic.xaml -->
|
||
<Style TargetType="controls:LatticeTabControl">
|
||
<Setter Property="Background" Value="{ThemeResource Lattice.Brush.Background.Primary}"/>
|
||
<Setter Property="BorderBrush" Value="{ThemeResource Lattice.Brush.Panel.Border}"/>
|
||
<Setter Property="BorderThickness" Value="{ThemeResource Lattice.Thickness.PanelBorder}"/>
|
||
<Setter Property="Template">
|
||
<Setter.Value>
|
||
<ControlTemplate TargetType="controls:LatticeTabControl">
|
||
<Grid x:Name="PART_RootGrid">
|
||
<!-- Заголовки вкладок -->
|
||
<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,0,0,2"/>
|
||
<Setter Property="Margin" Value="0,0,4,0"/>
|
||
<Setter Property="Padding" Value="0"/>
|
||
<Style.Triggers>
|
||
<Trigger Property="IsSelected" Value="True">
|
||
<Setter Property="BorderThickness" Value="0,0,0,2"/>
|
||
<Setter Property="Foreground" Value="{ThemeResource Lattice.Brush.Accent.Action}"/>
|
||
</Trigger>
|
||
<Trigger Property="IsPointerOver" Value="True">
|
||
<Setter Property="Background" Value="{ThemeResource SystemControlBackgroundListLowBrush}"/>
|
||
</Trigger>
|
||
</Style.Triggers>
|
||
</Style>
|
||
</ListBox.ItemContainerStyle>
|
||
<ListBox.ItemsPanel>
|
||
<ItemsPanelTemplate>
|
||
<StackPanel Orientation="Horizontal"/>
|
||
</ItemsPanelTemplate>
|
||
</ListBox.ItemsPanel>
|
||
</ListBox>
|
||
|
||
<!-- Контент вкладки -->
|
||
<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.Splitter.Hover" Color="#007ACC" />
|
||
<SolidColorBrush x:Key="Lattice.Brush.Accent.Action" Color="#007ACC" />
|
||
|
||
<CornerRadius x:Key="Lattice.Geometry.PanelCornerRadius">0</CornerRadius>
|
||
<Thickness x:Key="Lattice.Thickness.PanelMargin">0,0,1,1</Thickness>
|
||
<Thickness x:Key="Lattice.Thickness.PanelBorder">1</Thickness>
|
||
<x:Double x:Key="Lattice.Size.SplitterWidth">1</x:Double>
|
||
</ResourceDictionary>
|
||
</ResourceDictionary.MergedDictionaries>
|
||
|
||
</ResourceDictionary> |