Storyboard storyBoard = new Storyboard();
storyBoard.Completed += (sBoardSender, sBoardArgs) =>
{
MessageBox.Show("The button has been disapear !");
btnMain.Visibility = System.Windows.Visibility.Collapsed;
// OR
btnMain.IsEnabled = false;
};
// 1.0 to 0.0 in 3 seconds !!!
DoubleAnimation animationTime = new DoubleAnimation(1.0, 0.0, TimeSpan.FromSeconds(3));
// We want to go from 1.0 UIElement.OpacityProperty to 0.0 UIElement.OpacityProperty
Storyboard.SetTargetProperty(animationTime, new PropertyPath(UIElement.OpacityProperty));
storyBoard.Children.Add(animationTime);
storyBoard.Begin(btnMain, false);
البته این کد مبتنی بر Direct X هستش؛ و انتظار اجراش رو تو بقیه پلتفرم ها نداشته باشین.
مگه این که این کد رو تو SL بنویسین؛ اون وقت تو پلتفرم های معروف میتونید ازش پشتبانی کنین
Supported Platforms : Windows ( 98 - 7 ) Linux Mac OS , Win Mobile , Some Nokia Phones