功能更新
This commit is contained in:
211
Melskin/Controls/Anchor.xaml
Normal file
211
Melskin/Controls/Anchor.xaml
Normal file
@@ -0,0 +1,211 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:controls="clr-namespace:Melskin.Controls"
|
||||
xmlns:decorations="clr-namespace:Melskin.Controls.Decorations"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="/Melskin;Component/Themes/Animations.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<!-- ListBoxItem 的样式保持不变,因为我们内部还是用 ListBox 来显示锚点 -->
|
||||
<Style TargetType="{x:Type ListBoxItem}" x:Key="SlotAnchorItemStyle">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||
<Setter Property="Height" Value="40" />
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||
<!-- <Setter Property="Margin" Value="15" /> -->
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ListBoxItem}">
|
||||
<Grid>
|
||||
<decorations:SlotBorder
|
||||
ClipToBounds="True"
|
||||
HorizontalAlignment="Stretch"
|
||||
Intensity="0"
|
||||
Margin="-4"
|
||||
ShaderEnabled="False"
|
||||
x:Name="slot">
|
||||
<ContentPresenter
|
||||
HorizontalAlignment="Center"
|
||||
TextElement.FontWeight="Normal"
|
||||
TextElement.Foreground="{DynamicResource TextPrimaryBrush}"
|
||||
VerticalAlignment="Center"
|
||||
x:Name="content" />
|
||||
</decorations:SlotBorder>
|
||||
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="TextElement.Foreground" TargetName="content" Value="{DynamicResource PrimaryFocusedBrush}" />
|
||||
<Setter Property="Intensity" TargetName="slot" Value="0.15" />
|
||||
<Setter Property="ShaderEnabled" TargetName="slot" Value="True" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<!-- <Setter TargetName="ConvexShadow" Property="Background" Value="Transparent" /> -->
|
||||
<Setter Property="Intensity" TargetName="slot" Value="0.6" />
|
||||
<Setter Property="ShaderEnabled" TargetName="slot" Value="True" />
|
||||
<Setter Property="TextElement.FontWeight" TargetName="content" Value="Bold" />
|
||||
<Setter Property="TextElement.Foreground" TargetName="content" Value="{DynamicResource PrimaryGradientBrush}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- Anchor样式和模板 -->
|
||||
<Style TargetType="{x:Type controls:Anchor}" x:Key="EmbossAnchorStyle">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
||||
<Setter Property="Background" Value="{DynamicResource BackgroundLayoutBrush}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type controls:Anchor}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- 左侧: 锚点列表 -->
|
||||
<decorations:EmbossBorder
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
ClipToBounds="True"
|
||||
HorizontalAlignment="Stretch"
|
||||
Intensity="0">
|
||||
<ListBox
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
ItemContainerStyle="{StaticResource EmbossAnchorStyle}"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||
x:Name="PART_AnchorList" />
|
||||
</decorations:EmbossBorder>
|
||||
|
||||
<!-- 右侧: 内容滚动区 -->
|
||||
<ScrollViewer
|
||||
Grid.Column="1"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
x:Name="PART_ContentScroller">
|
||||
<!-- ContentPresenter 会将 Anchor 的 Content 放置在这里 -->
|
||||
<ContentPresenter />
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style TargetType="{x:Type ListBoxItem}" x:Key="FlatAnchorItemStyle">
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ControlBackgroundNormalBrush}" />
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||
<Setter Property="Height" Value="40" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Left" />
|
||||
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
||||
<!-- <Setter Property="Margin" Value="15" /> -->
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ListBoxItem}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="12" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border
|
||||
Background="{DynamicResource PrimaryNormalBrush}"
|
||||
CornerRadius="2"
|
||||
HorizontalAlignment="Left"
|
||||
Margin="2,4"
|
||||
RenderTransformOrigin="0.5, 0.5"
|
||||
Width="4"
|
||||
x:Name="Indicator">
|
||||
<Border.RenderTransform>
|
||||
<ScaleTransform ScaleY="0" />
|
||||
</Border.RenderTransform>
|
||||
</Border>
|
||||
<Border
|
||||
ClipToBounds="True"
|
||||
Grid.Column="1"
|
||||
HorizontalAlignment="Stretch">
|
||||
<ContentPresenter
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
TextElement.FontWeight="Normal"
|
||||
TextElement.Foreground="{DynamicResource TextPrimaryBrush}"
|
||||
VerticalAlignment="Center"
|
||||
x:Name="ContentPresenter" />
|
||||
</Border>
|
||||
|
||||
</Grid>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter Property="TextElement.Foreground" TargetName="ContentPresenter" Value="{DynamicResource PrimaryFocusedBrush}" />
|
||||
<!--<Setter Property="Background" Value="{DynamicResource }" />-->
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Visibility" TargetName="Indicator" Value="Visible" />
|
||||
<Setter Property="TextElement.FontWeight" TargetName="ContentPresenter" Value="Bold" />
|
||||
<Setter Property="TextElement.Foreground" TargetName="ContentPresenter" Value="{DynamicResource PrimaryNormalBrush}" />
|
||||
<Trigger.EnterActions>
|
||||
<BeginStoryboard Storyboard="{StaticResource ExtendYAnimation}" />
|
||||
</Trigger.EnterActions>
|
||||
|
||||
<Trigger.ExitActions>
|
||||
<BeginStoryboard Storyboard="{StaticResource ShrinkYAnimation}" />
|
||||
</Trigger.ExitActions>
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- Anchor样式和模板 -->
|
||||
<Style TargetType="{x:Type controls:Anchor}">
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource BorderNormalBrush}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
||||
<Setter Property="Background" Value="{DynamicResource BackgroundLayoutBrush}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type controls:Anchor}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- 左侧: 锚点列表 -->
|
||||
<Border
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
ClipToBounds="True"
|
||||
HorizontalAlignment="Stretch">
|
||||
<ListBox
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
ItemContainerStyle="{StaticResource FlatAnchorItemStyle}"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||
x:Name="PART_AnchorList" />
|
||||
</Border>
|
||||
<Rectangle
|
||||
Fill="{TemplateBinding BorderBrush}"
|
||||
Grid.Column="1"
|
||||
Margin="4,0"
|
||||
VerticalAlignment="Stretch"
|
||||
Width="2"
|
||||
x:Name="Separator" />
|
||||
<!-- 右侧: 内容滚动区 -->
|
||||
<ScrollViewer
|
||||
Grid.Column="2"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
x:Name="PART_ContentScroller">
|
||||
<!-- ContentPresenter 会将 Anchor 的 Content 放置在这里 -->
|
||||
<ContentPresenter />
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
Reference in New Issue
Block a user