Ooui-tws-port/Samples/EditorSample.cs

48 lines
1.1 KiB
C#
Raw Normal View History

2017-11-26 17:28:47 +00:00
using Ooui;
using Xamarin.Forms;
namespace Samples
{
public class EditorSample : ISample
{
2017-12-10 07:22:39 +00:00
public string Title => "Xamarin.Forms Editor Sample";
2018-09-02 04:56:35 +00:00
public string Path => "/editor";
2017-11-26 17:28:47 +00:00
public Ooui.Element CreateElement()
{
var panel = new StackLayout();
var titleLabel = new Xamarin.Forms.Label
{
2017-12-10 07:22:39 +00:00
Text = "Editor",
FontSize = 24,
FontAttributes = FontAttributes.Bold,
2017-11-26 17:28:47 +00:00
};
panel.Children.Add(titleLabel);
var editor = new Editor();
panel.Children.Add(editor);
var labelEditor = new Xamarin.Forms.Label();
panel.Children.Add(labelEditor);
editor.TextChanged += (sender, args) =>
{
labelEditor.Text = args.NewTextValue;
};
var page = new ContentPage
{
Content = panel
};
return page.GetOouiElement();
}
public void Publish()
{
2023-03-17 08:08:32 +00:00
PageExtensions.Ui.Publish(Path, CreateElement);
2017-11-26 17:28:47 +00:00
}
}
}