开始仔细学习WPF了ide
说是动画不流畅,能够经过设置帧率解决,查了不少,都说设置Timeline.DesiredFrameRateProperty,学习
但都没说加到哪里,在代码不少地方加上了,通通无效。最后在google角落里找到了动画
设置App.xamlgoogle
<Application x:Class="demo_d.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:demo_d" StartupUri="MainWindow.xaml" Startup="Application_Startup" > <Application.Resources> </Application.Resources> </Application>
注意这个:Startup="Application_Startup"spa
在App.xaml.cs里面写code
/// <summary> /// App.xaml 的交互逻辑 /// </summary> public partial class App : Application { private void Application_Startup(object sender, StartupEventArgs e) { Timeline.DesiredFrameRateProperty.OverrideMetadata( typeof(Timeline), new FrameworkPropertyMetadata { DefaultValue = null } ); }
DefaultValue = null 能够是具体值60、90、100本身设置xml
效果:在流畅的动画里面看不出来,将null设置为十、5等较小的值就看出来了blog