diff options
Diffstat (limited to 'Xamarin.Forms.Core/HtmlWebViewSource.cs')
-rw-r--r-- | Xamarin.Forms.Core/HtmlWebViewSource.cs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Xamarin.Forms.Core/HtmlWebViewSource.cs b/Xamarin.Forms.Core/HtmlWebViewSource.cs new file mode 100644 index 00000000..157e5054 --- /dev/null +++ b/Xamarin.Forms.Core/HtmlWebViewSource.cs @@ -0,0 +1,28 @@ +namespace Xamarin.Forms +{ + public class HtmlWebViewSource : WebViewSource + { + public static readonly BindableProperty HtmlProperty = BindableProperty.Create("Html", typeof(string), typeof(HtmlWebViewSource), default(string), + propertyChanged: (bindable, oldvalue, newvalue) => ((HtmlWebViewSource)bindable).OnSourceChanged()); + + public static readonly BindableProperty BaseUrlProperty = BindableProperty.Create("BaseUrl", typeof(string), typeof(HtmlWebViewSource), default(string), + propertyChanged: (bindable, oldvalue, newvalue) => ((HtmlWebViewSource)bindable).OnSourceChanged()); + + public string BaseUrl + { + get { return (string)GetValue(BaseUrlProperty); } + set { SetValue(BaseUrlProperty, value); } + } + + public string Html + { + get { return (string)GetValue(HtmlProperty); } + set { SetValue(HtmlProperty, value); } + } + + internal override void Load(IWebViewRenderer renderer) + { + renderer.LoadHtml(Html, BaseUrl); + } + } +}
\ No newline at end of file |