WPF一种背景动画效果
开发工具与关键技术:Visual Studio 2017、WPF
撰写时间: 2019年7月12日
这是微软的Samples,可以运用在一些具有画面感的页面上,下面用XAML代码实现:
<Window
x:Class="Wpf1.Window10"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
WindowStartupLocation="CenterScreen"
Title="Window10" Height="450" Width="800">
<Window.Triggers>
<EventTrigger
RoutedEvent="Page.Loaded">
<BeginStoryboard
Name="backgroundAnimationsBeginStoryboard">
<Storyboard >
<ColorAnimation
Storyboard.TargetName="mainPanel"
Storyboard.TargetProperty="(DockPanel.Background).(DrawingBrush.Drawing).(DrawingGroup.Children)[0].(Geometry