Skip to content

Instantly share code, notes, and snippets.

@brendanzagaeski
Created March 18, 2014 18:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brendanzagaeski/9626279 to your computer and use it in GitHub Desktop.
Save brendanzagaeski/9626279 to your computer and use it in GitHub Desktop.
Work around for Xamarin.Android binding of methods in the Socialize SDK's `ITwitterAuthWebView` that are inherited as properties from `WebView`
using System;
using Android.Views;
using Android.Webkit;
namespace Com.Socialize.Auth.Twitter
{
/// <summary>
/// Use "wrapper" methods to work around these two binding errors:
/// Error message: Error CS0535: `Com.Socialize.Auth.Twitter.TwitterAuthWebView' does not implement interface member `Com.Socialize.Auth.Twitter.ITwitterAuthWebView.SetLayoutParams(Android.Views.ViewGroup.LayoutParams)' (CS0535)
/// Error message: Error CS0535: `Com.Socialize.Auth.Twitter.TwitterAuthWebView' does not implement interface member `Com.Socialize.Auth.Twitter.ITwitterAuthWebView.SetVisibility(int)' (CS0535)
/// </summary>
/// <remarks>
/// Although _in theory_ you could work around the errors by changing the
/// setter methods in `ITwitterAuthWebView` to `set` methods of properties,
/// this would be against recommended property design practice:
/// "DO NOT provide set-only properties"
/// (http://msdn.microsoft.com/en-us/library/ms229006.aspx)
/// </remarks>
public partial class TwitterAuthWebView
{
public void SetLayoutParams(ViewGroup.LayoutParams parameters)
{
LayoutParameters = parameters;
}
public void SetVisibility(int visibility)
{
Visibility = (ViewStates)visibility;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment