调整代码
This commit is contained in:
149
Melskin/Controls/TutorialPrompt.xaml
Normal file
149
Melskin/Controls/TutorialPrompt.xaml
Normal file
@@ -0,0 +1,149 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:Melskin.Controls">
|
||||
|
||||
<Style TargetType="{x:Type local:TutorialHighlighter}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type local:TutorialHighlighter}">
|
||||
<Grid>
|
||||
<!-- 呼吸灯效果的边框 -->
|
||||
<Border
|
||||
x:Name="BreathBorder"
|
||||
BorderBrush="{DynamicResource PrimaryNormalBrush}"
|
||||
BorderThickness="2"
|
||||
CornerRadius="4">
|
||||
<Border.Effect>
|
||||
<BlurEffect Radius="8" />
|
||||
</Border.Effect>
|
||||
|
||||
<!-- 把动画触发器放到元素自身,保证名称解析在正确的名称域内 -->
|
||||
<Border.Triggers>
|
||||
<EventTrigger RoutedEvent="FrameworkElement.Loaded">
|
||||
<BeginStoryboard>
|
||||
<Storyboard AutoReverse="True" RepeatBehavior="Forever">
|
||||
<DoubleAnimation
|
||||
Storyboard.TargetName="BreathBorder"
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
From="0.3"
|
||||
To="1"
|
||||
Duration="0:0:1" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</EventTrigger>
|
||||
</Border.Triggers>
|
||||
</Border>
|
||||
|
||||
<Border
|
||||
BorderBrush="{DynamicResource PrimaryNormalBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style TargetType="{x:Type local:TutorialGuide}">
|
||||
<Setter Property="Background" Value="{DynamicResource BackgroundContainerBrush}" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource TextPrimaryBrush}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type local:TutorialGuide}">
|
||||
<!-- 增加外层 Grid 以容纳箭头 -->
|
||||
<Grid x:Name="LayoutRoot" Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- 主体卡片 -->
|
||||
<Border
|
||||
x:Name="MainBorder"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Width="350"
|
||||
Padding="16"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{DynamicResource BorderSecondaryBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="6">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect
|
||||
BlurRadius="20"
|
||||
Opacity="0.4"
|
||||
ShadowDepth="4" />
|
||||
</Border.Effect>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Header -->
|
||||
<DockPanel Margin="0,0,0,12">
|
||||
<TextBlock
|
||||
FontSize="16"
|
||||
FontWeight="Bold"
|
||||
Foreground="{DynamicResource PrimaryNormalBrush}"
|
||||
Text="{TemplateBinding Title}" />
|
||||
<Button
|
||||
x:Name="PART_CloseBtn"
|
||||
HorizontalAlignment="Right"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Content="✕"
|
||||
Cursor="Hand"
|
||||
DockPanel.Dock="Right"
|
||||
Foreground="{DynamicResource TextSecondaryBrush}" />
|
||||
</DockPanel>
|
||||
|
||||
<!-- Content -->
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
Margin="0,0,0,20"
|
||||
Foreground="{DynamicResource TextPrimaryBrush}"
|
||||
LineHeight="20"
|
||||
Text="{TemplateBinding Description}"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<!-- Footer -->
|
||||
<Grid Grid.Row="2">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource TextSecondaryBrush}"
|
||||
Text="{TemplateBinding StepText}" />
|
||||
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<Button
|
||||
x:Name="PART_BackBtn"
|
||||
Margin="0,0,8,0"
|
||||
Padding="12,5"
|
||||
Background="{DynamicResource BackgroundOverlayBrush}"
|
||||
BorderThickness="0"
|
||||
Content="上一步"
|
||||
Foreground="{DynamicResource TextAccentBrush}" />
|
||||
<Button
|
||||
x:Name="PART_NextBtn"
|
||||
Padding="15,5"
|
||||
Background="{DynamicResource PrimaryNormalBrush}"
|
||||
BorderThickness="0"
|
||||
Content="下一步"
|
||||
Foreground="{DynamicResource TextAccentBrush}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
Reference in New Issue
Block a user