// Example 16-21. Code behind for Example 16-20

using System;
using System.Windows;
using System.Windows.Threading;
using System.Diagnostics;

namespace Holding
{
    public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();

            t = new DispatcherTimer();
            t.Tick += new EventHandler(OnTimerTick);
            t.Interval = TimeSpan.FromSeconds(0.5);
            t.Start();
            start = DateTime.Now;
        }

        DispatcherTimer t;
        DateTime start;

        void OnTimerTick(object sender, EventArgs e)
        {
            TimeSpan elapsedTime = DateTime.Now - start;
            Debug.WriteLine(elapsedTime.ToString() + ": " +
                myEllipse.Width);
        }
    }
}

// End of Example 16-21.