From 17fdde66d94155fc62a034fa6658995bef6fd6e5 Mon Sep 17 00:00:00 2001 From: Jason Smith Date: Tue, 22 Mar 2016 13:02:25 -0700 Subject: Initial import --- .../CoreGalleryPages/EntryCoreGalleryPage.cs | 92 ++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 Xamarin.Forms.Controls/CoreGalleryPages/EntryCoreGalleryPage.cs (limited to 'Xamarin.Forms.Controls/CoreGalleryPages/EntryCoreGalleryPage.cs') diff --git a/Xamarin.Forms.Controls/CoreGalleryPages/EntryCoreGalleryPage.cs b/Xamarin.Forms.Controls/CoreGalleryPages/EntryCoreGalleryPage.cs new file mode 100644 index 00000000..2180f1f1 --- /dev/null +++ b/Xamarin.Forms.Controls/CoreGalleryPages/EntryCoreGalleryPage.cs @@ -0,0 +1,92 @@ +using Xamarin.Forms.CustomAttributes; + +namespace Xamarin.Forms.Controls +{ + internal class EntryCoreGalleryPage : CoreGalleryPage + { + protected override bool SupportsTapGestureRecognizer + { + get { return false; } + } + + protected override void Build (StackLayout stackLayout) + { + base.Build (stackLayout); + + var completedContainer = new EventViewContainer (Test.Entry.Completed, new Entry { Placeholder = "Completed" }); + completedContainer.View.Completed += (sender, args) => completedContainer.EventFired (); + + var placeholderContainer = new ViewContainer (Test.Entry.Placeholder, new Entry { Placeholder = "Placeholder" }); + var keyboardContainer = new ViewContainer (Test.InputView.Keyboard, new Entry { Keyboard = Keyboard.Numeric }); + var isPasswordContainer = new ViewContainer (Test.Entry.IsPassword, new Entry { IsPassword = true }); + var textContainer = new ViewContainer (Test.Entry.Text, new Entry { Text = "Hi, I am Text" }); + + var textChangedContainer = new EventViewContainer (Test.Entry.TextChanged, new Entry ()); + textChangedContainer.View.TextChanged += (sender, args) => textChangedContainer.EventFired (); + + var textFontAttributesContainer = new ViewContainer (Test.Entry.FontAttributes, new Entry { Text = "I have italic text", FontAttributes = FontAttributes.Italic }); + var textFamilyContainer1 = new ViewContainer (Test.Entry.FontFamily, new Entry { Text = "I have Comic Sans text in Win & Android", FontFamily = "Comic Sans MS" }); + var textFamilyContainer2 = new ViewContainer (Test.Entry.FontFamily, new Entry { Text = "I have bold Chalkboard text in iOS", FontFamily = "ChalkboardSE-Regular", FontAttributes = FontAttributes.Bold }); + var textFontSizeContainer = new ViewContainer (Test.Entry.FontSize, new Entry { Text = "I have default size text" }); + var textFontSizeDefaultContainer = new ViewContainer (Test.Entry.FontSize, new Entry { Text = "I also have default size text" }); + textFontSizeDefaultContainer.View.FontSize = Device.GetNamedSize (NamedSize.Default, textFontSizeDefaultContainer.View); + var textFontSizeLargeContainer = new ViewContainer (Test.Entry.FontSize, new Entry { Text = "I have size 48 (huge) text", FontSize = 48 }); + + var textColorContainer = new ViewContainer (Test.Entry.TextColor, new Entry { Text = "Hi, I should be red", TextColor = Color.Red }); + + var xAlignCenterContainer = new ViewContainer (Test.Entry.HorizontalTextAlignmentCenter, + new Entry { Text = "Should be centered", HorizontalTextAlignment = TextAlignment.Center }); + var xAlignEndContainer = new ViewContainer (Test.Entry.HorizontalTextAlignmentEnd, + new Entry { Text = "Should be aligned end", HorizontalTextAlignment = TextAlignment.End }); + var xAlignStartContainer = new ViewContainer (Test.Entry.HorizontalTextAlignmentStart, + new Entry { Text = "Should be aligned start", HorizontalTextAlignment = TextAlignment.Start }); + + var xAlignPlaceholderCenter = new ViewContainer (Test.Entry.HorizontalTextAlignmentPlaceholderCenter, + new Entry { Placeholder = "Should be centered", HorizontalTextAlignment = TextAlignment.Center }); + var xAlignPlaceholderEnd = new ViewContainer (Test.Entry.HorizontalTextAlignmentPlaceholderEnd, + new Entry { Placeholder = "Should be aligned end", HorizontalTextAlignment = TextAlignment.End }); + var xAlignPlaceholderStart = new ViewContainer (Test.Entry.HorizontalTextAlignmentPlaceholderStart, + new Entry { Placeholder = "Should be aligned start", HorizontalTextAlignment = TextAlignment.Start }); + + var placeholderColorContainer = new ViewContainer (Test.Entry.PlaceholderColor, + new Entry { Placeholder = "Hi, I should be red", PlaceholderColor = Color.Red }); + + var textColorDisabledContainer = new ViewContainer (Test.Entry.TextDisabledColor, + new Entry { IsEnabled = false, Text = "I should be the default disabled color", TextColor = Color.Red }); + + var placeholderColorDisabledContainer = new ViewContainer (Test.Entry.PlaceholderDisabledColor, + new Entry { + IsEnabled = false, + Placeholder = "I should be the default placeholder disabled color", + PlaceholderColor = Color.Red + }); + + var passwordColorContainer = new ViewContainer (Test.Entry.PasswordColor, + new Entry { IsPassword = true, Text = "12345", TextColor = Color.Red }); + + Add (isPasswordContainer); + Add (completedContainer); + Add (placeholderContainer); + Add (keyboardContainer); + Add (textContainer); + Add (textChangedContainer); + Add (textColorContainer); + Add (xAlignPlaceholderCenter); + Add (xAlignCenterContainer); + Add (xAlignPlaceholderEnd); + Add (xAlignEndContainer); + Add (xAlignPlaceholderStart); + Add (xAlignStartContainer); + Add (textFontAttributesContainer); + Add (textFamilyContainer1); + Add (textFamilyContainer2); + Add (textFontSizeContainer); + Add (textFontSizeDefaultContainer); + Add (textFontSizeLargeContainer); + Add (placeholderColorContainer); + Add (textColorDisabledContainer); + Add (placeholderColorDisabledContainer); + Add (passwordColorContainer); + } + } +} \ No newline at end of file -- cgit v1.2.3