我目前正在通过淡出它来从用户界面中删除一个元素。这按预期工作。
public void HideShape()
{
if (this.TangibleShape != null)
{
DoubleAnimation animation = new DoubleAnimation();
animation.From = 1.0;
animation.To = 0.0;
animation.AutoReverse = false;
animation.Duration = TimeSpan.FromSeconds(1.5);
Storyboard s = new Storyboard();
s.Children.Add(animation);
Storyboard.SetTarget(animation, this.TangibleShape.Shape);
Storyboard.SetTargetProperty(animation, new PropertyPath(ScatterViewItem.OpacityProperty));
s.Begin(this.TangibleShape.Shape);
s.Completed += delegate(object sender, EventArgs e)
{
// call UIElementManager to finally hide the element
UIElementManager.GetInstance().Hide(this.TangibleShape);
};
}
}
问题是我想在某些情况下再次将不透明度设置为 1 但TangibleShape.Shape
(它是 a ScatterViewItem
)忽略该命令。如果我再次淡出,元素变得可见并立即开始淡出。我不知道如何解决这个问题。有人对我有提示吗?