Added issue #48 repro

This commit is contained in:
Frank A. Krueger 2018-02-01 23:14:07 -08:00
parent e24eef87c9
commit 957f9d7333
No known key found for this signature in database
GPG Key ID: 0471C67474FFE664
2 changed files with 41 additions and 1 deletions

View File

@ -1,6 +1,6 @@
// Ooui v1.0.0 // Ooui v1.0.0
var debug = false; var debug = true;
const nodes = {}; const nodes = {};
const hasText = {}; const hasText = {};

View File

@ -0,0 +1,40 @@
using Ooui;
using Xamarin.Forms;
namespace Samples
{
// From https://github.com/praeclarum/Ooui/issues/48
public class SwitchErrorSample : ISample
{
public string Title => "Xamarin.Forms Switch Error";
public Ooui.Element CreateElement ()
{
var layout = new StackLayout();
var label = new Xamarin.Forms.Label
{
Text = "Switch state goes here",
HorizontalTextAlignment = TextAlignment.Center
};
var sw = new Switch
{
HorizontalOptions = LayoutOptions.CenterAndExpand
};
sw.Toggled += (sender, args) =>
{
label.Text = $"Switch state is :{((Switch)sender).IsToggled}";
};
layout.Children.Add(label);
layout.Children.Add(sw);
return new ContentPage
{
Content = layout
}.GetOouiElement();
}
public void Publish()
{
UI.Publish ("/switch", CreateElement);
}
}
}