開始仔細學習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