計算機科学のブログ

start building apps with C# - Build something great…fast! - XAML, Label

Head First C Sharp: A Learner’s Guide to Real-World Programming with C Sharp and .NET (Andrew Stellman(著)、Jennifer Greene(著)、O’Reilly Media)のChapter 1(start building apps with C# - Build something great…fast!)、p.31(Exercise)の解答を求めてみる。

Markup Language

MainPage.xaml

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="AnimalMatchingGame.MainPage">

    <ScrollView>
        <VerticalStackLayout
            Padding="30,0"
            Spacing="25">
            <Button x:Name="PlayAgainButton"
                    Text="Play again?"
                    FontSize="Large"
                    Clicked="PlayAgainButton_Clicked"/>
            <Label x:Name="TimeElapsed"
                   Text="Time Elapsed: 0.0 seconds"
                   FontSize="Large"/>

        </VerticalStackLayout>
    </ScrollView>

</ContentPage>