45 lines
990 B
C#
45 lines
990 B
C#
|
using Ooui;
|
|||
|
using Xamarin.Forms;
|
|||
|
|
|||
|
namespace Samples
|
|||
|
{
|
|||
|
public class EditorSample : ISample
|
|||
|
{
|
|||
|
public string Title => "Editor Sample";
|
|||
|
|
|||
|
public Ooui.Element CreateElement()
|
|||
|
{
|
|||
|
var panel = new StackLayout();
|
|||
|
|
|||
|
var titleLabel = new Xamarin.Forms.Label
|
|||
|
{
|
|||
|
Text = "Editor"
|
|||
|
};
|
|||
|
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()
|
|||
|
{
|
|||
|
UI.Publish("/editor", CreateElement);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|