Skip to content

Instantly share code, notes, and snippets.

@benbishop
Created March 5, 2014 20:13
Show Gist options
  • Save benbishop/9375644 to your computer and use it in GitHub Desktop.
Save benbishop/9375644 to your computer and use it in GitHub Desktop.
A C# Xamarin Class Extension for ViewGroup that lets you easily disable all contents of ViewGroup from touches.
using System;
using Android.Views;
using Android.Widget;
namespace Rendr.Community
{
public static class UIExtensions
{
public static void SetChildrenEnabled (this ViewGroup group, bool enabled)
{
for (int i = 0; i < group.ChildCount; i++) {
View view = group.GetChildAt (i);
view.Clickable = view.Enabled = enabled;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment