Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0" encoding="utf-8" ?>
<Grid xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Tesla.Control.StatusBarLabel" VerticalOptions="FillAndExpand"
RowSpacing="0" ColumnSpacing="0">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Label x:Name="MainLabel" Grid.Row="0" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" VerticalOptions="FillAndExpand" />
<?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:gesture="clr-namespace:Mobile.Gestures;assembly=Mobile"
x:Class="Mobile.View.MainPage" BackgroundColor="Black">
<Label Text="Press Me" WidthRequest="250" HeightRequest="100" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" TextColor="{Binding TextColor}" BackgroundColor="{Binding BackgroundColor}" VerticalOptions="Center" HorizontalOptions="Center">
<Label.GestureRecognizers>
<gesture:PressedGestureRecognizer Command="{Binding PressedGestureCommand}" />
<gesture:ReleasedGestureRecognizer Command="{Binding ReleasedGestureCommand}" />
[assembly: ExportRenderer(typeof(Label), typeof(LabelRender))]
namespace Mobile.iOS.Renderer
{
public class LabelRender : LabelRenderer
{
private class TouchLabel : UILabel
{
Label Element = null;
public TouchLabel(Label element)
{
[assembly: ExportRenderer(typeof(Label), typeof(LabelRender))]
namespace Mobile.Droid.Renderer
{
public class LabelRender: LabelRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Label> e)
{
base.OnElementChanged(e);
[assembly: ExportRenderer(typeof(Label), typeof(LabelRender))]
namespace Mobile.UWP.Renderer
{
public class LabelRender : LabelRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Label> e)
{
base.OnElementChanged(e);
public class PressedGestureRecognizer : Element, IGestureRecognizer
{
public static readonly BindableProperty CommandProperty = BindableProperty.Create("Command", typeof(ICommand), typeof(PressedGestureRecognizer), (object)null, BindingMode.OneWay, (BindableProperty.ValidateValueDelegate)null, (BindableProperty.BindingPropertyChangedDelegate)null, (BindableProperty.BindingPropertyChangingDelegate)null, (BindableProperty.CoerceValueDelegate)null, (BindableProperty.CreateDefaultValueDelegate)null);
public static readonly BindableProperty CommandParameterProperty = BindableProperty.Create("CommandParameter", typeof(object), typeof(PressedGestureRecognizer), (object)null, BindingMode.TwoWay, (BindableProperty.ValidateValueDelegate)null, (BindableProperty.BindingPropertyChangedDelegate)null, (BindableProperty.BindingPropertyChangingDelegate)null, (BindableProperty.CoerceValueDelegate)null, (BindableProperty.CreateDefaultValueDelegate)null);
public ICommand Command
{
@adamped
adamped / Toast Notifier
Created January 25, 2016 00:45
Toast Notifier Example Usage
var notificator = DependencyService.Get<IToastNotificator>();
bool tapped = await notificator.Notify(ToastNotificationType.Info, "Title", "Description", TimeSpan.FromSeconds(2));
public string GetPlatform()
{
var path = "unknown";
#if WINDOWS_PHONE
path = "windowsphone";
#else
#if __SILVERLIGHT__
@adamped
adamped / Login Email
Created January 10, 2016 01:59
Call Screen Object
[Test]
public void CheckEmail()
{
var screen = new Screen.Login(app);
Assert.AreEqual("[email protected]", screen.GetEmailText());
}
@adamped
adamped / Login
Created January 10, 2016 01:58
Screen Object Pattern Example
namespace Mobile.UITest.Screen
{
public class Login
{
IApp _app = null;
public Login(IApp app)
{
_app = app;
}