In this section, instead of dragging and dropping controls, we will add XAML code:
Move
MainWindow.xaml
to XAML and add the code shown here to addTextBlock
and three buttons inGrid
:<Grid x:Name="LayoutRoot"> <TextBlock Text="00:00" Height="170" Margin="49,32,38,116" Width="429" FontSize="48"/> <Button Content="Start" Height="50" Margin="49,220,342,49" Width="125"/> <Button Content="Stop" Height="50" Margin="203,220,188,49" Width="125"/> <Button Content="Reset" Height="50" Margin="353,220,38,49" Width="125"/> </Grid>
We set a few properties for each of the elements. The property types of the various properties are also mentioned. These are the .NET types to which the type converter would convert them:
Content: This is the content displayed onscreen. This property is of the
Object
type.Height: This is the height of the button. This property is of the
Double
type.Width: This is the...