Skip to content

Instantly share code, notes, and snippets.

Avatar

Tiago Crizanto tiagocrizanto

View GitHub Profile
View HybridWebView.cs
public class HybridWebView : WebView
{
public HybridWebView()
{
}
public static readonly BindableProperty UsernameProperty =
BindableProperty.Create("UserName", typeof(string), typeof(HybridWebView), null, BindingMode.TwoWay);
public static readonly BindableProperty PasswordProperty =
View HybridWebViewRenderer.cs
[assembly: ExportRenderer(typeof(HybridWebView), typeof(HybridWebViewRenderer))]
namespace FcaBrain.Droid.Renderers
{
public class HybridWebViewRenderer : WebViewRenderer
{
private new HybridWebView Element { get { return (HybridWebView)base.Element; } }
public HybridWebViewRenderer(Android.Content.Context context) : base(context) { }
protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.WebView> e)
View HybridWebViewRenderer.cs
[assembly: ExportRenderer(typeof(HybridWebView), typeof(HybridWebViewRenderer))]
namespace ProxyWebView.iOS
{
public class HybridWebViewRenderer : ViewRenderer<HybridWebView, WKWebView>
{
WKUserContentController userController;
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged(sender, e);
View MainPage.xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:ProxyWebView.Htttp; assembly=ProxyWebView"
x:Class="ProxyWebView.MainPage">
<StackLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
<!--Webview genérica-->
<!--<WebView HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" BackgroundColor="AliceBlue" x:Name="webview"/>-->
View MainPage.xaml.cs
public partial class MainPage : ContentPage
{
private MainPage _mainPage;
public MainPage()
{
InitializeComponent();
_mainPage = this;
hwebview.Username = "username"; //usually active directory user
hwebview.Password = "password";
You can’t perform that action at this time.