該筆記內容是在 cs 內把 Label.Text 從預設的 Welcome to Xamarin Forms! 改為 Hello World to Xamarin Forms!
xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:App1"
x:Class="App1.MainPage">
<Label
x:Name="lbl"
Text="Welcome to Xamarin Forms!"
VerticalOptions="Center"
HorizontalOptions="Center" />
</ContentPage>
cs 檔案using Xamarin.Forms.Xaml;
namespace App1
{
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
lbl.Text = "Hello World to Xamarin Forms!";
}
}
}
沒有留言:
張貼留言