我可以在窗口中调整datagrid的大小,直到我执行此代码:
// Handle the tabcontrol animation
DoubleAnimation dbTbViewsAnimation =
new DoubleAnimation(dToTabHeightParameter, new Duration(new TimeSpan(0,0,1)));
this.tbViews.BeginAnimation(TabControl.HeightProperty, dbTbViewsAnimation);
// Handle the tabcontrol animation
DoubleAnimation dbCurrentPlaylistHeightAnimation =
new DoubleAnimation(dToCurrentPlaylistParameter, new Duration(new TimeSpan(0, 0, 1)));
this.dgCurrentPlaylist.BeginAnimation(DataGrid.HeightProperty, dbCurrentPlaylistHeightAnimation);
此代码中的问题是什么以及阻止数据网格大小调整的原因? 谢谢!
答案 0 :(得分:0)
见Timeline.FillBehavior Property。默认值为HoldEnd。您可以使用构造函数重载来更改此行为。
DoubleAnimation dbTbViewsAnimation =
new DoubleAnimation(dToTabHeightParameter,
new Duration(new TimeSpan(0,0,1)),
FillBehavior.Stop);
仅供参考:How to: Set a Property After Animating It with a Storyboard