using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
public class MainWindow : Window
{
Button btn = new Button();
[STAThread]
public static void Main()
{
Application app = new Application();
app.Run(new MainWindow());
}
public MainWindow()
{
btn.Content = "Expanding Button";
btn.FontSize = 12;
btn.HorizontalAlignment = HorizontalAlignment.Center;
btn.VerticalAlignment = VerticalAlignment.Center;
btn.Click += ButtonOnClick;
Content = btn;
}
void ButtonOnClick(object sender, RoutedEventArgs args)
{
DoubleAnimation anima = new DoubleAnimation();
anima.Duration = new Duration(TimeSpan.FromSeconds(2));
anima.From = 12;
anima.To = 48;
anima.FillBehavior = FillBehavior.Stop;
btn.BeginAnimation(Button.FontSizeProperty, anima);
}
}