summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls/CoreGalleryPages/SearchBarCoreGalleryPage.cs
diff options
context:
space:
mode:
authorJason Smith <jason.smith@xamarin.com>2016-03-22 13:02:25 -0700
committerJason Smith <jason.smith@xamarin.com>2016-03-22 16:13:41 -0700
commit17fdde66d94155fc62a034fa6658995bef6fd6e5 (patch)
treeb5e5073a2a7b15cdbe826faa5c763e270a505729 /Xamarin.Forms.Controls/CoreGalleryPages/SearchBarCoreGalleryPage.cs
downloadxamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.gz
xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.bz2
xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.zip
Initial import
Diffstat (limited to 'Xamarin.Forms.Controls/CoreGalleryPages/SearchBarCoreGalleryPage.cs')
-rw-r--r--Xamarin.Forms.Controls/CoreGalleryPages/SearchBarCoreGalleryPage.cs89
1 files changed, 89 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls/CoreGalleryPages/SearchBarCoreGalleryPage.cs b/Xamarin.Forms.Controls/CoreGalleryPages/SearchBarCoreGalleryPage.cs
new file mode 100644
index 00000000..0221b87c
--- /dev/null
+++ b/Xamarin.Forms.Controls/CoreGalleryPages/SearchBarCoreGalleryPage.cs
@@ -0,0 +1,89 @@
+using Xamarin.Forms.CustomAttributes;
+
+namespace Xamarin.Forms.Controls
+{
+ internal class SearchBarCoreGalleryPage : CoreGalleryPage<SearchBar>
+ {
+ // TODO
+ protected override bool SupportsTapGestureRecognizer
+ {
+ get { return false; }
+ }
+
+ protected override void Build (StackLayout stackLayout)
+ {
+ base.Build (stackLayout);
+ var placeholderContainer = new ViewContainer<SearchBar> (Test.SearchBar.PlaceHolder, new SearchBar { Placeholder = "Placeholder" });
+
+ var searchButtonPressedContainer = new EventViewContainer<SearchBar> (Test.SearchBar.SearchButtonPressed, new SearchBar { });
+ searchButtonPressedContainer.View.SearchButtonPressed += (sender, args) => searchButtonPressedContainer.EventFired ();
+
+ var searchCommandContainer = new ViewContainer<SearchBar> (Test.SearchBar.SearchCommand,
+ new SearchBar {
+ SearchCommand = new Command (async () => await DisplayAlert ("Search command", "Fired", "Ok"))
+ }
+ );
+
+ var textContainer = new ViewContainer<SearchBar> (Test.SearchBar.Text, new SearchBar { Text = "I am text" });
+
+ var textChangedContainer = new EventViewContainer<SearchBar> (Test.SearchBar.TextChanged, new SearchBar { Placeholder = "I am text changed" });
+ textChangedContainer.View.TextChanged += (sender, args) => textChangedContainer.EventFired ();
+
+ var cancelButtonColor = new ViewContainer<SearchBar> (
+ Test.SearchBar.CancelButtonColor,
+ new SearchBar {
+ Placeholder = "Should have a red cancel button",
+ CancelButtonColor = Color.Red
+ }
+ );
+
+ var textFontAttributesContainer = new ViewContainer<SearchBar> (Test.SearchBar.FontAttributes, new SearchBar { Text = "I have italic text", FontAttributes = FontAttributes.Italic });
+ var textFamilyContainer1 = new ViewContainer<SearchBar> (Test.SearchBar.FontFamily, new SearchBar { Text = "I have Comic Sans text in Win & Android", FontFamily = "Comic Sans MS" });
+ var textFamilyContainer2 = new ViewContainer<SearchBar> (Test.SearchBar.FontFamily, new SearchBar { Text = "I have bold Chalkboard text in iOS", FontFamily = "ChalkboardSE-Regular", FontAttributes = FontAttributes.Bold });
+ var textFontSizeContainer = new ViewContainer<SearchBar> (Test.SearchBar.FontSize, new SearchBar { Text = "I have default size text" });
+ var textFontSizeDefaultContainer = new ViewContainer<SearchBar> (Test.SearchBar.FontSize, new SearchBar { Text = "I also have default size text" });
+ textFontSizeDefaultContainer.View.FontSize = Device.GetNamedSize (NamedSize.Default, textFontSizeDefaultContainer.View);
+ var textFontSizeLargeContainer = new ViewContainer<SearchBar> (Test.SearchBar.FontSize, new SearchBar { Text = "I have size 48 (huge) text", FontSize = 48 });
+
+ var textAlignmentStartContainer = new ViewContainer<SearchBar> (Test.SearchBar.TextAlignmentStart,
+ new SearchBar { Text = "I should be at the start", HorizontalTextAlignment = TextAlignment.Start });
+ var textAlignmentCenterContainer = new ViewContainer<SearchBar> (Test.SearchBar.TextAlignmentCenter,
+ new SearchBar { Text = "I should be centered", HorizontalTextAlignment = TextAlignment.Center });
+ var textAlignmentEndContainer = new ViewContainer<SearchBar> (Test.SearchBar.TextAlignmentEnd,
+ new SearchBar { Text = "I should be at the end", HorizontalTextAlignment = TextAlignment.End });
+
+ var placeholderAlignmentStartContainer = new ViewContainer<SearchBar> (Test.SearchBar.PlaceholderAlignmentStart,
+ new SearchBar { Placeholder = "I should be at the start", HorizontalTextAlignment = TextAlignment.Start });
+ var placeholderAlignmentCenterContainer = new ViewContainer<SearchBar> (Test.SearchBar.PlaceholderAlignmentCenter,
+ new SearchBar { Placeholder = "I should be centered", HorizontalTextAlignment = TextAlignment.Center });
+ var placeholderAlignmentEndContainer = new ViewContainer<SearchBar> (Test.SearchBar.PlaceholderAlignmentEnd,
+ new SearchBar { Placeholder = "I should be at the end", HorizontalTextAlignment = TextAlignment.End });
+
+ var textColorContainer = new ViewContainer<SearchBar> (Test.SearchBar.TextColor,
+ new SearchBar { Text = "I should be red", TextColor = Color.Red });
+
+ var placeholderColorContainer = new ViewContainer<SearchBar> (Test.SearchBar.PlaceholderColor,
+ new SearchBar { Placeholder = "I should be red", PlaceholderColor = Color.Red });
+ Add (placeholderContainer);
+ Add (searchButtonPressedContainer);
+ Add (searchCommandContainer);
+ Add (textContainer);
+ Add (textChangedContainer);
+ Add (textFontAttributesContainer);
+ Add (textFamilyContainer1);
+ Add (textFamilyContainer2);
+ Add (textFontSizeContainer);
+ Add (textFontSizeDefaultContainer);
+ Add (textFontSizeLargeContainer);
+ Add (cancelButtonColor);
+ Add (textAlignmentStartContainer);
+ Add (textAlignmentCenterContainer);
+ Add (textAlignmentEndContainer);
+ Add (placeholderAlignmentStartContainer);
+ Add (placeholderAlignmentCenterContainer);
+ Add (placeholderAlignmentEndContainer);
+ Add (textColorContainer);
+ Add (placeholderColorContainer);
+ }
+ }
+} \ No newline at end of file