Skip to content

Commit

Permalink
Add Property UseWideViewPort.
Browse files Browse the repository at this point in the history
  • Loading branch information
drmashu committed Dec 19, 2017
1 parent 6ee2ea4 commit 453d719
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -53,3 +53,4 @@
SampleApp\.userprefs

SampleApp/SampleApp\.MacOS/\.DS_Store
*.vspscc
6 changes: 6 additions & 0 deletions Xam.Plugin.WebView.Abstractions/FormsWebView.Static.cs
Expand Up @@ -51,6 +51,12 @@ public partial class FormsWebView
/// </summary>
public static readonly BindableProperty EnableGlobalHeadersProperty = BindableProperty.Create(nameof(EnableGlobalHeaders), typeof(bool), typeof(FormsWebView), true);


/// <summary>
/// A bindable property for the ScalesPageToFit property.
/// </summary>
public static readonly BindableProperty UseWideViewPortProperty = BindableProperty.Create(nameof(UseWideViewPort), typeof(bool), typeof(FormsWebView), false);

/// <summary>
/// A dictionary used to add headers which are used throughout all instances of FormsWebView.
/// </summary>
Expand Down
6 changes: 6 additions & 0 deletions Xam.Plugin.WebView.Abstractions/FormsWebView.cs
Expand Up @@ -137,6 +137,12 @@ public bool CanGoForward
internal set => SetValue(CanGoForwardProperty, value);
}

public bool UseWideViewPort
{
get => (bool) GetValue(UseWideViewPortProperty);
set => SetValue(UseWideViewPortProperty, value);
}

public FormsWebView()
{
HorizontalOptions = VerticalOptions = LayoutOptions.FillAndExpand;
Expand Down
7 changes: 6 additions & 1 deletion Xam.Plugin.WebView.Droid/FormsWebViewRenderer.cs
Expand Up @@ -48,8 +48,13 @@ protected override void OnElementChanged(ElementChangedEventArgs<FormsWebView> e

if (e.OldElement != null)
DestroyElement(e.OldElement);
}

if (Element.UseWideViewPort)
{
Control.Settings.LoadWithOverviewMode = true;
Control.Settings.UseWideViewPort = true;
}
}
void SetupElement(FormsWebView element)
{
element.PropertyChanged += OnPropertyChanged;
Expand Down

0 comments on commit 453d719

Please sign in to comment.