Skip to content

Instantly share code, notes, and snippets.

@kamranayub
Created April 6, 2013 01:21
Show Gist options
  • Save kamranayub/5324242 to your computer and use it in GitHub Desktop.
Save kamranayub/5324242 to your computer and use it in GitHub Desktop.
Transparent button for Windows Phone
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
namespace MyApp.Phone.UI.Controls {
public class TransparentButton : ContentControl {
public TransparentButton() {
HorizontalContentAlignment = HorizontalAlignment.Stretch;
}
public override void OnApplyTemplate() {
var child = Content as Panel;
if (child != null && child.Background == null) {
child.Background = new SolidColorBrush(Colors.Transparent);
}
base.OnApplyTemplate();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment