Add XAML example

This commit is contained in:
Frank A. Krueger 2017-11-15 23:59:40 -06:00
parent 64cc7a22d8
commit f550c55e90
4 changed files with 52 additions and 0 deletions

9
Samples/ButtonXamlPage.xaml Executable file
View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="ButtonXaml.ButtonXamlPage">
<Button Text="Tap for click count!"
Clicked="OnButtonClicked" />
</ContentPage>

23
Samples/ButtonXamlPage.xaml.cs Executable file
View File

@ -0,0 +1,23 @@
using System;
using Xamarin.Forms;
namespace ButtonXaml
{
public partial class ButtonXamlPage
{
int count = 0;
public ButtonXamlPage()
{
InitializeComponent();
}
public void OnButtonClicked(object sender, EventArgs args)
{
count++;
((Button)sender).Text =
String.Format("{0} click{1}!", count, count == 1 ? "" : "s");
}
}
}

View File

@ -0,0 +1,17 @@
using System;
using Ooui;
using Xamarin.Forms;
namespace Samples
{
public class ButtonXamlPageSample : ISample
{
public string Title => "Xamarin.Forms Button XAML";
public Ooui.Element CreateElement ()
{
var page = new ButtonXaml.ButtonXamlPage ();
return page.GetOouiElement ();
}
}
}

View File

@ -8,6 +8,9 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Xamarin.Forms" Version="2.4.0.38779" /> <PackageReference Include="Xamarin.Forms" Version="2.4.0.38779" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<EmbeddedResource Include="**/*" />
</ItemGroup>
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework> <TargetFramework>netcoreapp2.0</TargetFramework>