我正在使用此代码从左侧边距为对象设置动画
ThicknessAnimation da = new ThicknessAnimation();
double width = borderModel.Width;
if (ConstantValue.HideShowModelPanel == false)
{
da.From = new Thickness(0,0,0,6);
da.To = new Thickness(-width,0,0,6);
da.Duration = TimeSpan.FromSeconds(0.8);
ConstantValue.HideShowModelPanel = true;
}
else
{
da.From =new Thickness(-width,0,0,6);
da.To = new Thickness(0,0,0,6);
da.Duration = TimeSpan.FromSeconds(0.2);
ConstantValue.HideShowModelPanel = false;
}
Storyboard.SetTarget(da, borderModel);
Storyboard.SetTargetProperty(da, new PropertyPath("Margin"));
story.Children.Add(da);
story.Begin();
//borderModel.BeginAnimation(new PropertyPath("Margin"), da);
我不会隐藏和显示对象。请告诉我我哪里错了?