Skip to content

Instantly share code, notes, and snippets.

@stackunderflows
Last active January 27, 2020 18:03
Show Gist options
  • Save stackunderflows/6454dc2a0a96694022d882b1bea55d90 to your computer and use it in GitHub Desktop.
Save stackunderflows/6454dc2a0a96694022d882b1bea55d90 to your computer and use it in GitHub Desktop.
Floating label example
<?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:ios="clr-namespace:Xamarin.Forms.PlatformConfiguration.iOSSpecific;assembly=Xamarin.Forms.Core"
xmlns:local="clr-namespace:PhantomLib"
xmlns:extensions="clr-namespace:PhantomLib.Extensions;assembly=PhantomLib"
xmlns:controls="clr-namespace:PhantomLib.CustomControls;assembly=PhantomLib"
xmlns:effects="clr-namespace:PhantomLib.Effects;assembly=PhantomLib"
xmlns:behaviors="clr-namespace:PhantomLib.Behaviors;assembly=PhantomLib"
xmlns:localvms="clr-namespace:PhantomLibSamples.ViewModels;assembly=PhantomLibSamples"
x:Class="PhantomLibSamples.UltimateEntry.UltimateEntryPage"
BackgroundColor="{DynamicResource PrimaryColor}"
Title="Ultimate Entry">
<ContentPage.Resources>
<ResourceDictionary>
<Style x:Key="MaterialEntry" TargetType="controls:UltimateEntry">
<Setter Property="ThicknessPadding" Value="10,0,2,0" />
<Setter Property="Grid.Row" Value="1" />
<Setter Property="TextColor" Value="{DynamicResource PrimaryFontColor}" />
<Setter Property="ImageTintColor" Value="{DynamicResource AccentColor}" />
<Setter Property="UnderlineColor" Value="{DynamicResource AccentColor}" />
<Setter Property="FocusedBackgroundColor" Value="{DynamicResource PrimaryColor}" />
<Setter Property="BackgroundColor" Value="{DynamicResource PrimaryColor}" />
<Setter Property="ReturnButton" Value="Next" />
<Setter Property="PlaceholderColor" Value="{DynamicResource SecondaryFontColor}" />
<Setter Property="ErrorImageSource" Value="icon_error" />
<Setter Property="ErrorImageTintColor" Value="{DynamicResource ErrorColor}" />
</Style>
</ResourceDictionary>
</ContentPage.Resources>
<StackLayout Padding="20">
<Frame Padding="0" BackgroundColor="Black" CornerRadius="5">
<StackLayout Padding="20,20,20,15">
<Label Text="UltimateEntry with floating label placeholder" Style="{StaticResource Headline}" />
<controls:FloatingLabel x:Name="UsernameFloatingLabel" PlaceholderText="Username" Style="{StaticResource FloatingLabel}"
UltimateEntry="{x:Reference FloatingUsername}">
<controls:UltimateEntry x:Name="FloatingUsername" Style="{StaticResource MaterialEntry}" />
</controls:FloatingLabel>
</StackLayout>
</Frame>
</StackLayout>
</ContentPage.Content>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment