Доработан winui
This commit is contained in:
@@ -4,7 +4,8 @@
|
||||
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:models="using:Lattice.Core.Docking.Models"
|
||||
xmlns:muxc="using:Microsoft.UI.Xaml.Controls">
|
||||
|
||||
<!-- 1. Шаблоны -->
|
||||
<DataTemplate x:Key="LatticeGroupTemplate">
|
||||
@@ -20,55 +21,73 @@
|
||||
GroupTemplate="{StaticResource LatticeGroupTemplate}"
|
||||
LeafTemplate="{StaticResource LatticeLeafTemplate}" />
|
||||
|
||||
<!-- 3. Стиль Сплиттера -->
|
||||
<!-- 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 Fill="{TemplateBinding Background}"
|
||||
Width="{ThemeResource Lattice.Size.SplitterWidth}"
|
||||
<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. Стиль Хоста -->
|
||||
<!-- 4. Стиль Host -->
|
||||
<Style TargetType="controls:LatticeDockHost">
|
||||
<Setter Property="Background" Value="{ThemeResource Lattice.Brush.Background.Primary}"/>
|
||||
<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" />
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
Padding="4">
|
||||
<ContentControl x:Name="PART_RootContainer"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
VerticalContentAlignment="Stretch" />
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- 5. Стиль Группы (Рекурсия) -->
|
||||
<!-- 5. Стиль Group -->
|
||||
<Style TargetType="controls:LatticeDockGroup">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="controls:LatticeDockGroup">
|
||||
<!-- Grid перестраивается в коде LatticeDockGroup.cs -->
|
||||
<Grid x:Name="PART_Grid">
|
||||
<!-- Первая область -->
|
||||
<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" />
|
||||
|
||||
<!-- Сплиттер (его положение в Grid.Row/Column устанавливается автоматически при перестроении Grid) -->
|
||||
<controls:LatticeSplitter x:Name="PART_Splitter" />
|
||||
<!-- 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}"
|
||||
@@ -80,58 +99,16 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- 6. Стиль Листа -->
|
||||
<!-- 6. Стиль TabControl -->
|
||||
<Style TargetType="controls:LatticeDockLeaf">
|
||||
<Setter Property="VerticalContentAlignment" Value="Stretch" />
|
||||
<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 и 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">
|
||||
<!-- Заголовки вкладок -->
|
||||
<Grid x:Name="PART_RootGrid" Background="{TemplateBinding Background}">
|
||||
<!-- Tab headers -->
|
||||
<ListBox x:Name="PART_TabHeaderList"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
@@ -142,18 +119,46 @@
|
||||
<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="BorderThickness" Value="0"/>
|
||||
<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>
|
||||
<!-- Используем 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>
|
||||
@@ -163,7 +168,7 @@
|
||||
</ListBox.ItemsPanel>
|
||||
</ListBox>
|
||||
|
||||
<!-- Контент вкладки -->
|
||||
<!-- Tab content -->
|
||||
<ContentControl x:Name="PART_ContentControl"
|
||||
Background="{TemplateBinding Background}"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
@@ -174,21 +179,28 @@
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- 7. Ресурсы по умолчанию (если тема не загружена) -->
|
||||
<!-- 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" />
|
||||
<SolidColorBrush x:Key="Lattice.Brush.Accent" Color="#007ACC" />
|
||||
<SolidColorBrush x:Key="Lattice.Brush.Text.Primary" Color="#FFFFFF" />
|
||||
|
||||
<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>
|
||||
<!-- Геометрия -->
|
||||
<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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user