简单认识 Xamarin
xamarin 的四个文件:App.xaml,App.xaml.cs,onePage.xaml,onePage.xaml.cs。
App.xaml:
<Application xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="one.App">
<Application.Resources>
<!-- Application resource dictionary -->
</Application.Resources>
</Application>
App.xaml.cs:
using Xamarin.Forms;
namespace one
{
public partial class App : Application
{
public App()
{
InitializeComponent();
MainPage = new onePage();
}
protected override void OnStart()
{
// Handle when your app starts
}
protected override void OnSleep()
{
// Handle when your app sleeps
}
protected override void OnResume()
{
// Handle when your app resumes
}
}
}
onePage.xaml:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:one" x:Class="one.onePage">
<Label Text="Welcome to Xamarin Forms!" VerticalOptions="Center" HorizontalOptions="Center" />
</ContentPage>
onePage.xaml.cs:
namespace one
{
public partial class onePage : ContentPage
{
public onePage()
{
InitializeComponent();
}
}
}
效果如下: