All I wanted to do was show my 5-year-old daughter how a number can count forward on the screen.
This waits 135 seconds and then displays "135".
What do I have to change so that it displays the number as it counts?
XAML:
<Window x:Class="TestCount234.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="768" Width="1024">
<StackPanel>
<TextBlock
HorizontalAlignment="Center"
FontSize="444" x:Name="TheNumber"/>
</StackPanel>
</Window>
Code Behind:
using System.Windows;
using System.Threading;
namespace TestCount234
{
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
Loaded += new RoutedEventHandler(Window1_Loaded);
}
void Window1_Loaded(object sender, RoutedEventArgs e)
{
for (int i = 0; i <= 135; i++)
{
TheNumber.Text = i.ToString();
Thread.Sleep(1000);
}
}
}
}