2018-01-21 19:13:38 +00:00
|
|
|
|
using Ooui;
|
|
|
|
|
using Xamarin.Forms;
|
|
|
|
|
|
|
|
|
|
namespace Samples
|
|
|
|
|
{
|
|
|
|
|
public class WebViewSample : ISample
|
|
|
|
|
{
|
|
|
|
|
public string Title => "Xamarin.Forms WebView Sample";
|
2018-09-02 04:56:35 +00:00
|
|
|
|
public string Path => "/webview";
|
2018-01-21 19:13:38 +00:00
|
|
|
|
|
|
|
|
|
public Ooui.Element CreateElement()
|
|
|
|
|
{
|
|
|
|
|
var panel = new StackLayout();
|
|
|
|
|
|
|
|
|
|
var titleLabel = new Xamarin.Forms.Label
|
|
|
|
|
{
|
|
|
|
|
Text = "WebView",
|
|
|
|
|
FontSize = 24,
|
|
|
|
|
FontAttributes = FontAttributes.Bold
|
|
|
|
|
};
|
|
|
|
|
panel.Children.Add(titleLabel);
|
|
|
|
|
|
|
|
|
|
WebView webview = new WebView
|
|
|
|
|
{
|
|
|
|
|
Source = "http://www.xamarin.com"
|
|
|
|
|
};
|
|
|
|
|
panel.Children.Add(webview);
|
|
|
|
|
|
|
|
|
|
var page = new ContentPage
|
|
|
|
|
{
|
|
|
|
|
Content = panel
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return page.GetOouiElement();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Publish()
|
|
|
|
|
{
|
2018-09-02 04:56:35 +00:00
|
|
|
|
UI.Publish(Path, CreateElement);
|
2018-01-21 19:13:38 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|