пʼятниця, 23 червня 2017 р.

Making the xaml page


It is not enough to create 2 files:

SomePage2.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:Sample" x:Class="Sample.SomePage2">
  <Label Text="Welcome to Xamarin Forms!" VerticalOptions="Center" HorizontalOptions="Center" />
</ContentPage>

SomePage2.xaml.cs

using Xamarin.Forms;
  namespace Sample
  {
    public partial class SomePage2 : ContentPage
    {
      public SomePage2()
     {
       InitializeComponent();
     }
   }
 }

Additionally you will need to edit the Sample.csproj file manually, for example:

<ItemGroup>
  <EmbeddedResource Include="App.xaml" />
  <EmbeddedResource Include="SamplePage.xaml" />
  <EmbeddedResource Include="SomePage2.xaml" />
</ItemGroup>

<ItemGroup>
  <Compile Include="App.xaml.cs">
    <DependentUpon>App.xaml</DependentUpon>
  </Compile>
  <Compile Include="SamplePage.xaml.cs">
    <DependentUpon>SamplePage.xaml</DependentUpon>
  </Compile>
  <Compile Include="SomePage2.xaml.cs">
    <DependentUpon>SomePage2.xaml</DependentUpon>
  </Compile>
...
</ItemGroup>

Немає коментарів:

Дописати коментар