Mobile menggunakan xamarin
Berikut langkah - langkah membuat aplikasi xamarin secara sederhana di visual studio
1. Buat Project Xamarin.Forms
2. Berikut untuk kode MainPage.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | <?xml version="1.0" encoding="utf-8" ?> x:Class="AmazingApp.MainPage"> <StackLayout> <Frame BackgroundColor="#2196F3" Padding="24" CornerRadius="0"> <Label Text="Welcome to Xamarin.Forms!" HorizontalTextAlignment="Center" TextColor="White" FontSize="36"/> </Frame> <Button Text="Click Me!" Clicked="ClickCounter"/> <Label Text="Hello, World!" FontSize="Title" Padding="30,10,30,10"/> <Label Text="Mobile Development With Xamarin" FontSize="16" Padding="30,0,30,0"/> <Label FontSize="16" Padding="30,24,30,0"> <Label.FormattedText> <FormattedString> <FormattedString.Spans> <Span Text="Learn more at "/> </FormattedString.Spans> </FormattedString> </Label.FormattedText> </Label> </StackLayout></ContentPage> |
4. Berikut untuk kode MainPage.xml.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | namespace AmazingApp{ public partial class MainPage : ContentPage { public MainPage() { InitializeComponent(); } int count = 0; void ClickCounter(object sender, System.EventArgs e) { count++; ((Button)sender).Text = $"You clicked {count} times."; } }} |
Hasilnya akan sebagai berikut :

Comments
Post a Comment