diff options
Diffstat (limited to 'Xamarin.Forms.Controls/GalleryPages/CellsGalleries')
11 files changed, 728 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/EntryCellListPage.cs b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/EntryCellListPage.cs new file mode 100644 index 00000000..b70a9f82 --- /dev/null +++ b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/EntryCellListPage.cs @@ -0,0 +1,54 @@ +using System.Linq; + +namespace Xamarin.Forms.Controls +{ + [Preserve (AllMembers = true)] + public class EntryCellTest { + public string Label { get; set; } + public string Placeholder { get; set; } + public Color LabelColor { get; set; } + public Color PlaceholderColor { get; set; } + + } + + public class EntryCellListPage : ContentPage + { + public EntryCellListPage () + { + Title = "EntryCell List Gallery - Legacy"; + + Device.OnPlatform (iOS: () => { + if (Device.Idiom == TargetIdiom.Tablet) { + Padding = new Thickness (0, 0, 0, 60); + } + }); + + var dataTemplate = new DataTemplate (typeof(EntryCell)); + dataTemplate.SetBinding (EntryCell.LabelProperty, new Binding ("Label")); + dataTemplate.SetBinding (EntryCell.LabelColorProperty, new Binding ("LabelColor")); + dataTemplate.SetBinding (EntryCell.PlaceholderProperty, new Binding ("Placeholder")); + + var label = new Label { + Text = "I have not been selected" + }; + + var listView = new ListView { + ItemsSource = Enumerable.Range (0, 100).Select (i => new EntryCellTest { + Label = "Label " + i, + LabelColor = i % 2 == 0 ? Color.Red : Color.Blue, + Placeholder = "Placeholder " + i, + PlaceholderColor = i % 2 == 0 ? Color.Red : Color.Blue, + }), + ItemTemplate = dataTemplate + }; + + listView.ItemSelected += (sender, args) => { + label.Text = "I have been selected"; + }; + + + + Content = new StackLayout { Children = { label, listView } }; + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/EntryCellTablePage.cs b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/EntryCellTablePage.cs new file mode 100644 index 00000000..c37dd441 --- /dev/null +++ b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/EntryCellTablePage.cs @@ -0,0 +1,85 @@ +namespace Xamarin.Forms.Controls +{ + public class EntryCellTablePage : ContentPage + { + public EntryCellTablePage () + { + Title = "EntryCell Table Gallery - Legacy"; + + Device.OnPlatform (iOS: () => { + if (Device.Idiom == TargetIdiom.Tablet) { + Padding = new Thickness (0, 0, 0, 60); + } + }); + + int timesEntered = 1; + + var entryCell = new EntryCell { Label = "Enter text", Placeholder = "I am a placeholder" }; + entryCell.Completed += (sender, args) => { + ((EntryCell)sender).Label = "Entered: " + timesEntered; + timesEntered++; + }; + + var tableSection = new TableSection ("Section One") { + new EntryCell { Label = "disabled", Placeholder = "disabled", IsEnabled = false }, + new EntryCell { Label = "Text 2" }, + new EntryCell { Label = "Text 3", Placeholder = "Placeholder 2" }, + new EntryCell { Label = "Text 4" }, + new EntryCell { Label = "Text 5", Placeholder = "Placeholder 3" }, + new EntryCell { Label = "Text 6" }, + new EntryCell { Label = "Text 7", Placeholder = "Placeholder 4" }, + new EntryCell { Label = "Text 8" }, + new EntryCell { Label = "Text 9", Placeholder = "Placeholder 5" }, + new EntryCell { Label = "Text 10" }, + new EntryCell { Label = "Text 11", Placeholder = "Placeholder 6" }, + new EntryCell { Label = "Text 12" }, + new EntryCell { Label = "Text 13", Placeholder = "Placeholder 7" }, + new EntryCell { Label = "Text 14" }, + new EntryCell { Label = "Text 15", Placeholder = "Placeholder 8" }, + new EntryCell { Label = "Text 16" }, + entryCell + }; + + var tableSectionTwo = new TableSection ("Section Two") { + new EntryCell { Label = "Text 17", Placeholder = "Placeholder 9" }, + new EntryCell { Label = "Text 18" }, + new EntryCell { Label = "Text 19", Placeholder = "Placeholder 10" }, + new EntryCell { Label = "Text 20" }, + new EntryCell { Label = "Text 21", Placeholder = "Placeholder 11" }, + new EntryCell { Label = "Text 22" }, + new EntryCell { Label = "Text 23", Placeholder = "Placeholder 12" }, + new EntryCell { Label = "Text 24" }, + new EntryCell { Label = "Text 25", Placeholder = "Placeholder 13" }, + new EntryCell { Label = "Text 26" }, + new EntryCell { Label = "Text 27", Placeholder = "Placeholder 14" }, + new EntryCell { Label = "Text 28" }, + new EntryCell { Label = "Text 29", Placeholder = "Placeholder 15" }, + new EntryCell { Label = "Text 30" }, + new EntryCell { Label = "Text 31", Placeholder = "Placeholder 16" }, + new EntryCell { Label = "Text 32" }, + }; + + var keyboards = new TableSection ("Keyboards") { + new EntryCell { Label = "Chat", Keyboard = Keyboard.Chat }, + new EntryCell { Label = "Default", Keyboard = Keyboard.Default }, + new EntryCell { Label = "Email", Keyboard = Keyboard.Email }, + new EntryCell { Label = "Numeric", Keyboard = Keyboard.Numeric }, + new EntryCell { Label = "Telephone", Keyboard = Keyboard.Telephone }, + new EntryCell { Label = "Text", Keyboard = Keyboard.Text }, + new EntryCell { Label = "Url", Keyboard = Keyboard.Url } + }; + + var root = new TableRoot ("Text Cell table") { + tableSection, + tableSectionTwo, + keyboards + }; + + var table = new TableView { + Root = root + }; + + Content = table; + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ImageCellListPage.cs b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ImageCellListPage.cs new file mode 100644 index 00000000..1f58a339 --- /dev/null +++ b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ImageCellListPage.cs @@ -0,0 +1,121 @@ +using System; +using System.Linq; +using System.Collections.Generic; + +namespace Xamarin.Forms.Controls +{ + [Preserve (AllMembers = true)] + public class ImageCellTest { + public object Text { get; set; } + public object TextColor { get; set; } + public object Detail { get; set; } + public object DetailColor { get; set; } + public object Image { get; set; } + } + + public class ImageCellListPage : ContentPage + { + + public ImageCellListPage () + { + Title = "ImageCell List Gallery - Legacy"; + + Device.OnPlatform (iOS: () => { + if (Device.Idiom == TargetIdiom.Tablet) { + Padding = new Thickness (0, 0, 0, 60); + } + }); + + var dataTemplate = new DataTemplate (typeof (ImageCell)); + var stringToImageSourceConverter = new GenericValueConverter ( + obj => new FileImageSource { + File = (string) obj + } + ); + + dataTemplate.SetBinding (TextCell.TextProperty, new Binding ("Text")); + dataTemplate.SetBinding (TextCell.TextColorProperty, new Binding ("TextColor")); + dataTemplate.SetBinding (TextCell.DetailProperty, new Binding ("Detail")); + dataTemplate.SetBinding (TextCell.DetailColorProperty, new Binding ("DetailColor")); + dataTemplate.SetBinding (ImageCell.ImageSourceProperty, new Binding ("Image", converter: stringToImageSourceConverter)); + + Random rand = new Random(250); + + var albums = new [] { + "crimsonsmall.jpg", + "oasissmall.jpg", + "cover1small.jpg" + }; + + var label = new Label { Text = "I have not been selected" }; + + var listView = new ListView { + AutomationId = "ImageCellListView", + ItemsSource = Enumerable.Range (0, 100).Select (i => new ImageCellTest { + Text = "Text " + i, + TextColor = i % 2 == 0 ? Color.Red : Color.Blue, + Detail = "Detail " + i, + DetailColor = i % 2 == 0 ? Color.Red : Color.Blue, + Image = albums[rand.Next(0,3)] + }), + ItemTemplate = dataTemplate + }; + + listView.ItemSelected += (sender, args) => label.Text = "I was selected"; + + Content = new StackLayout { Children = { label, listView } }; + + } + } + + public class UrlImageCellListPage : ContentPage + { + public UrlImageCellListPage() + { + Device.OnPlatform (iOS: () => { + if (Device.Idiom == TargetIdiom.Tablet) { + Padding = new Thickness (0, 0, 0, 60); + } + }); + + var dataTemplate = new DataTemplate (typeof (ImageCell)); + var stringToImageSourceConverter = new GenericValueConverter ( + obj => new UriImageSource() { + Uri = new Uri ((string) obj) + }); + + dataTemplate.SetBinding (TextCell.TextProperty, new Binding ("Text")); + dataTemplate.SetBinding (TextCell.TextColorProperty, new Binding ("TextColor")); + dataTemplate.SetBinding (TextCell.DetailProperty, new Binding ("Detail")); + dataTemplate.SetBinding (TextCell.DetailColorProperty, new Binding ("DetailColor")); + dataTemplate.SetBinding (ImageCell.ImageSourceProperty, + new Binding ("Image", converter: stringToImageSourceConverter)); + + var albums = new List<string> (); + for (int i = 0; i < 30; i++) { + albums.Add (string.Format ("http://cdn.instructables.com/FCP/9TOJ/GCJ0ZQV5/FCP9TOJGCJ0ZQV5.MEDIUM.jpg?ticks={0}",i )); + } + + + var random = new Random(); + var label = new Label { Text = "I have not been selected" }; + + var listView = new ListView { + AutomationId = "ImageUrlCellListView", + ItemsSource = Enumerable.Range (0, 300).Select (i => new ImageCellTest { + Text = "Text " + i, + TextColor = i % 2 == 0 ? Color.Red : Color.Blue, + Detail = "Detail " + i, + DetailColor = i % 2 == 0 ? Color.Red : Color.Blue, + Image = albums [random.Next (0, albums.Count - 1)] + }), + ItemTemplate = dataTemplate + }; + + listView.ItemSelected += (sender, args) => label.Text = "I was selected"; + + Content = new StackLayout { Children = { label, listView } }; + + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ImageCellTablePage.cs b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ImageCellTablePage.cs new file mode 100644 index 00000000..2b941bfd --- /dev/null +++ b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ImageCellTablePage.cs @@ -0,0 +1,68 @@ +namespace Xamarin.Forms.Controls +{ + public class ImageCellTablePage : ContentPage + { + + public ImageCellTablePage () + { + Title = "ImageCell Table Gallery - Legacy"; + + Device.OnPlatform (iOS: () => { + if (Device.Idiom == TargetIdiom.Tablet) { + Padding = new Thickness (0, 0, 0, 60); + } + }); + + var tableSection = new TableSection ("Section One") { + new ImageCell { Text = "Text 1", ImageSource = new FileImageSource { File = "crimson.jpg" } }, + new ImageCell { Text = "Text 2", Detail = "Detail 1", ImageSource = new FileImageSource { File = "crimson.jpg" } }, + new ImageCell { Text = "Text 3", ImageSource = new FileImageSource { File = "cover1.jpg" } }, + new ImageCell { Text = "Text 4", Detail = "Detail 2", ImageSource = new FileImageSource { File = "cover1.jpg" } }, + new ImageCell { Text = "Text 5", ImageSource = new FileImageSource { File = "oasis.jpg" } }, + new ImageCell { Text = "Text 6", Detail = "Detail 3", ImageSource = new FileImageSource { File = "oasis.jpg" } }, + new ImageCell { Text = "Text 7", ImageSource = new FileImageSource { File = "crimson.jpg" } }, + new ImageCell { Text = "Text 8", Detail = "Detail 4", ImageSource = new FileImageSource { File = "crimson.jpg" } }, + new ImageCell { Text = "Text 9", ImageSource = new FileImageSource { File = "cover1.jpg" } }, + new ImageCell { Text = "Text 10", Detail = "Detail 5", ImageSource = new FileImageSource { File = "cover1.jpg" } }, + new ImageCell { Text = "Text 11", ImageSource = new FileImageSource { File = "oasis.jpg" } }, + new ImageCell { Text = "Text 12", Detail = "Detail 6", ImageSource = new FileImageSource { File = "oasis.jpg" } }, + }; + + ImageCell imageCell = null; + imageCell = new ImageCell { + Text = "not tapped", + ImageSource = "oasis.jpg", + Command = new Command(()=>{ + imageCell.Text = "tapped"; + (imageCell.ImageSource as FileImageSource).File = "crimson.jpg"; + }) + }; + var tableSectionTwo = new TableSection ("Section Two") { + new ImageCell { Text = "Text 13", ImageSource = new FileImageSource { File = "crimson.jpg" } }, + new ImageCell { Text = "Text 14", Detail = "Detail 7", ImageSource = new FileImageSource { File = "crimson.jpg" } }, + new ImageCell { Text = "Text 15", ImageSource = new FileImageSource { File = "cover1.jpg" } }, + new ImageCell { Text = "Text 16", Detail = "Detail 8", ImageSource = new FileImageSource { File = "cover1.jpg" } }, + new ImageCell { Text = "Text 17", ImageSource = new FileImageSource { File = "oasis.jpg" } }, + new ImageCell { Text = "Text 18", Detail = "Detail 9", ImageSource = new FileImageSource { File = "oasis.jpg" } }, + new ImageCell { Text = "Text 19", ImageSource = new FileImageSource { File = "crimson.jpg" } }, + new ImageCell { Text = "Text 20", Detail = "Detail 10", ImageSource = new FileImageSource { File = "crimson.jpg" } }, + new ImageCell { Text = "Text 21", ImageSource = new FileImageSource { File = "cover1.jpg" } }, + new ImageCell { Text = "Text 22", Detail = "Detail 11", ImageSource = new FileImageSource { File = "cover1.jpg" } }, + new ImageCell { Text = "Text 23", ImageSource = new FileImageSource { File = "oasis.jpg" } }, + new ImageCell { Text = "Text 24", Detail = "Detail 12", ImageSource = new FileImageSource { File = "oasis.jpg" } }, + imageCell, + }; + + var root = new TableRoot ("Text Cell table") { + tableSection, + tableSectionTwo + }; + + var table = new TableView { + Root = root, + }; + + Content = table; + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ProductViewCell.cs b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ProductViewCell.cs new file mode 100644 index 00000000..5973ebab --- /dev/null +++ b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ProductViewCell.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Xamarin.Forms.Controls +{ + public class ProductCellView : StackLayout + { + Label _timeLabel; + Label _brandLabel; + StackLayout _stack; + public ProductCellView (string text) + { + _stack = new StackLayout (); + _brandLabel = new Label {Text = "BrandLabel", HorizontalTextAlignment = TextAlignment.Center}; + _stack.Children.Add (_brandLabel); + + + var frame = new Frame { + Content = _stack, + BackgroundColor = Device.OnPlatform (iOS: new Color (1), Android: new Color (0.2), WinPhone: new Color (0.2)) + }; + _timeLabel = new Label { + Text = text + }; + Children.Add (_timeLabel); + Children.Add (frame); + Padding = new Size (20, 20); + } + } +} diff --git a/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/SwitchCellListPage.cs b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/SwitchCellListPage.cs new file mode 100644 index 00000000..c2502339 --- /dev/null +++ b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/SwitchCellListPage.cs @@ -0,0 +1,47 @@ +using System.Linq; + +namespace Xamarin.Forms.Controls +{ + [Preserve (AllMembers = true)] + public class SwitchCellItem + { + public string Label { get; set; } + public bool SwitchOn { get; set; } + } + + public class SwitchCellListPage : ContentPage + { + public SwitchCellListPage () + { + Title = "SwitchCell List Gallery - Legacy"; + + Device.OnPlatform (iOS: () => { + if (Device.Idiom == TargetIdiom.Tablet) { + Padding = new Thickness (0, 0, 0, 60); + } + }); + + var dataTemplate = new DataTemplate (typeof (SwitchCell)) { + Bindings = { + {SwitchCell.TextProperty, new Binding ("Label")}, + {SwitchCell.OnProperty, new Binding ("SwitchOn")}, + } + }; + + var label = new Label { Text = "I have not been selected" }; + + var listView = new ListView { + ItemsSource = Enumerable.Range (0, 100).Select (i => new SwitchCellItem { + Label = "Label " + i, + SwitchOn = i % 2 == 0 ? false : true, + }), + ItemTemplate = dataTemplate + }; + + listView.ItemSelected += (sender, args) => label.Text = "I was selected."; + + Content = new StackLayout { Children = { label, listView } }; + } + + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/SwitchCellTablePage.cs b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/SwitchCellTablePage.cs new file mode 100644 index 00000000..a0deb8e6 --- /dev/null +++ b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/SwitchCellTablePage.cs @@ -0,0 +1,65 @@ +namespace Xamarin.Forms.Controls +{ + public class SwitchCellTablePage : ContentPage + { + public SwitchCellTablePage () + { + Title = "SwitchCell Table Gallery - Legacy"; + + Device.OnPlatform (iOS: () => { + if (Device.Idiom == TargetIdiom.Tablet) { + Padding = new Thickness (0, 0, 0, 60); + } + }); + + var tableSection = new TableSection ("Section One") { + new SwitchCell { Text = "text 1", On = true }, + new SwitchCell { Text = "text 2" }, + new SwitchCell { Text = "text 3", On = true }, + new SwitchCell { Text = "text 4", On = false }, + new SwitchCell { Text = "text 5", On = true }, + new SwitchCell { Text = "text 6" }, + new SwitchCell { Text = "text 7", On = true }, + new SwitchCell { Text = "text 8", On = false }, + new SwitchCell { Text = "text 9", On = true }, + new SwitchCell { Text = "text 10" }, + new SwitchCell { Text = "text 11", On = true }, + new SwitchCell { Text = "text 12", On = false }, + new SwitchCell { Text = "text 13", On = true }, + new SwitchCell { Text = "text 14" }, + new SwitchCell { Text = "text 15", On = true }, + new SwitchCell { Text = "text 16", On = false }, + }; + + var tableSectionTwo = new TableSection ("Section Two") { + new SwitchCell { Text = "text 17", On = true }, + new SwitchCell { Text = "text 18" }, + new SwitchCell { Text = "text 19", On = true }, + new SwitchCell { Text = "text 20", On = false }, + new SwitchCell { Text = "text 21", On = true }, + new SwitchCell { Text = "text 22" }, + new SwitchCell { Text = "text 23", On = true }, + new SwitchCell { Text = "text 24", On = false }, + new SwitchCell { Text = "text 25", On = true }, + new SwitchCell { Text = "text 26" }, + new SwitchCell { Text = "text 27", On = true }, + new SwitchCell { Text = "text 28", On = false }, + new SwitchCell { Text = "text 29", On = true }, + new SwitchCell { Text = "text 30" }, + new SwitchCell { Text = "text 31", On = true }, + new SwitchCell { Text = "text 32", On = false }, + }; + + var root = new TableRoot ("Text Cell table") { + tableSection, + tableSectionTwo + }; + + var table = new TableView { + Root = root, + }; + + Content = table; + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/TextCellListPage.cs b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/TextCellListPage.cs new file mode 100644 index 00000000..fbd5e265 --- /dev/null +++ b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/TextCellListPage.cs @@ -0,0 +1,48 @@ +using System.Linq; + +namespace Xamarin.Forms.Controls +{ + [Preserve (AllMembers = true)] + public class TextCellTest { + public object Text { get; set; } + public object TextColor { get; set; } + public object Detail { get; set; } + public object DetailColor { get; set; } + } + + public class TextCellListPage : ContentPage + { + public TextCellListPage () + { + Title = "TextCell List Gallery - Legacy"; + + Device.OnPlatform (iOS: () => { + if (Device.Idiom == TargetIdiom.Tablet) { + Padding = new Thickness (0, 0, 0, 60); + } + }); + + var label = new Label { Text = "Not Selected" }; + + var dataTemplate = new DataTemplate (typeof (TextCell)); + dataTemplate.SetBinding (TextCell.TextProperty, new Binding ("Text")); + dataTemplate.SetBinding (TextCell.TextColorProperty, new Binding ("TextColor")); + dataTemplate.SetBinding (TextCell.DetailProperty, new Binding ("Detail")); + dataTemplate.SetBinding (TextCell.DetailColorProperty, new Binding ("DetailColor")); + + var listView = new ListView { + ItemsSource = Enumerable.Range (0, 100).Select (i => new TextCellTest { + Text = "Text " + i, + TextColor = i % 2 == 0 ? Color.Red : Color.Blue, + Detail = "Detail " + i, + DetailColor = i % 2 == 0 ? Color.Red : Color.Blue + }), + ItemTemplate = dataTemplate + }; + + listView.ItemSelected += (sender, args) => { label.Text = "I was selected"; }; + + Content = new StackLayout { Children = { label, listView } }; + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/TextCellTablePage.cs b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/TextCellTablePage.cs new file mode 100644 index 00000000..b9cc0cf3 --- /dev/null +++ b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/TextCellTablePage.cs @@ -0,0 +1,58 @@ +namespace Xamarin.Forms.Controls +{ + public class TextCellTablePage : ContentPage + { + + public TextCellTablePage () + { + Title = "TextCell Table Gallery - Legacy"; + + Device.OnPlatform (iOS: () => { + if (Device.Idiom == TargetIdiom.Tablet) { + Padding = new Thickness (0, 0, 0, 60); + } + }); + + var tableSection = new TableSection ("Section One") { + new TextCell { Text = "Text 1" }, + new TextCell { Text = "Text 2", Detail = "Detail 1" }, + new TextCell { Text = "Text 3" }, + new TextCell { Text = "Text 4", Detail = "Detail 2" }, + new TextCell { Text = "Text 5" }, + new TextCell { Text = "Text 6", Detail = "Detail 3" }, + new TextCell { Text = "Text 7" }, + new TextCell { Text = "Text 8", Detail = "Detail 4" }, + new TextCell { Text = "Text 9" }, + new TextCell { Text = "Text 10", Detail = "Detail 5" }, + new TextCell { Text = "Text 11" }, + new TextCell { Text = "Text 12", Detail = "Detail 6" } + }; + + var tableSectionTwo = new TableSection ("Section Two") { + new TextCell { Text = "Text 13" }, + new TextCell { Text = "Text 14", Detail = "Detail 7" }, + new TextCell { Text = "Text 15" }, + new TextCell { Text = "Text 16", Detail = "Detail 8" }, + new TextCell { Text = "Text 17" }, + new TextCell { Text = "Text 18", Detail = "Detail 9" }, + new TextCell { Text = "Text 19" }, + new TextCell { Text = "Text 20", Detail = "Detail 10" }, + new TextCell { Text = "Text 21" }, + new TextCell { Text = "Text 22", Detail = "Detail 11" }, + new TextCell { Text = "Text 23" }, + new TextCell { Text = "Text 24", Detail = "Detail 12" } + }; + + var root = new TableRoot ("Text Cell table") { + tableSection, + tableSectionTwo + }; + + var table = new TableView { + Root = root, + }; + + Content = table; + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/UnEvenViewCellGallery.cs b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/UnEvenViewCellGallery.cs new file mode 100644 index 00000000..00c2980f --- /dev/null +++ b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/UnEvenViewCellGallery.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Xamarin.Forms.Controls +{ + public class UnevenViewCellGallery : ContentPage + { + public UnevenViewCellGallery () + { + Title = "UnevenViewCell Gallery - Legacy"; + + var map = MapGallery.MakeMap (); + map.HasScrollEnabled = false; + + Content = new TableView { + RowHeight = 150, + HasUnevenRows = true, + Root = new TableRoot { + new TableSection ("Testing") { + new ViewCell {View = map, Height = 250}, + new ViewCell {View = new ProductCellView ("1 day")}, + new ViewCell {View = new ProductCellView ("2 days")}, + new ViewCell {View = new ProductCellView ("3 days")}, + new ViewCell {View = new ProductCellView ("4 days")}, + new ViewCell {View = new ProductCellView ("5 days")} + } + } + }; + } + } +} diff --git a/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ViewCellGallery.cs b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ViewCellGallery.cs new file mode 100644 index 00000000..099a786a --- /dev/null +++ b/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/ViewCellGallery.cs @@ -0,0 +1,115 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Xamarin.Forms.Controls +{ + public class ViewCellGallery : ContentPage + { + public ViewCellGallery () + { + Title = "ViewCell Gallery - Legacy"; + + Content = new TableView { + RowHeight = 150, + Root = new TableRoot { + new TableSection ("Testing") { + new ViewCell {View = new ProductCellView ("0")}, + new ViewCell {View = new ProductCellView ("1")}, + new ViewCell {View = new ProductCellView ("2")}, + new ViewCell {View = new ProductCellView ("3")}, + new ViewCell {View = new ProductCellView ("4")} + } + } + }; + } + } + + public class UrlImageViewCellListPage : ContentPage + { + public UrlImageViewCellListPage() + { + Device.OnPlatform (iOS: () => { + if (Device.Idiom == TargetIdiom.Tablet) { + Padding = new Thickness (0, 0, 0, 60); + } + }); + + var stringToImageSourceConverter = new GenericValueConverter ( + obj => new UriImageSource() { + Uri = new Uri ((string) obj) + }); + + var dataTemplate = new DataTemplate (() => { + var cell = new ViewCell(); + + var image = new Image(); + image.SetBinding (Image.SourceProperty, new Binding ("Image", converter: stringToImageSourceConverter)); + image.WidthRequest = 160; + image.HeightRequest = 160; + + var text = new Label(); + text.SetBinding (Label.TextProperty, new Binding ("Text")); + text.SetBinding (Label.TextColorProperty, new Binding ("TextColor")); + + cell.View = new StackLayout { + Orientation = StackOrientation.Horizontal, + Children = { + image, + text + } + }; + + return cell; + }); + + var albums = new[] { + "https://evolve.xamarin.com/images/sessions/joseph-mayo-icon.jpg", + "https://evolve.xamarin.com/images/sessions/jon-skeet-icon.jpg", + "https://evolve.xamarin.com/images/sessions/rachel-reese-icon.jpg", + "https://evolve.xamarin.com/images/sessions/mike-james-icon.jpg", + "https://evolve.xamarin.com/images/sessions/daniel-cazzulino-icon.jpg", + "https://evolve.xamarin.com/images/sessions/michael-hutchinson-icon.jpg", + "https://evolve.xamarin.com/images/sessions/laurent-bugnion-icon.jpg", + "https://evolve.xamarin.com/images/sessions/craig-dunn-icon.jpg", + "https://evolve.xamarin.com/images/sessions/charles-petzold-icon.jpg", + "https://evolve.xamarin.com/images/sessions/jason-smith-icon.jpg", + "https://evolve.xamarin.com/images/sessions/frank-krueger-icon.jpg", + "https://evolve.xamarin.com/images/sessions/james-clancey-icon.jpg", + "https://evolve.xamarin.com/images/sessions/daniel-plaisted-icon.jpg", + "https://evolve.xamarin.com/images/sessions/jesse-liberty-icon.jpg", + "https://evolve.xamarin.com/images/sessions/miguel-de-icaza-icon.jpg", + "https://evolve.xamarin.com/images/sessions/rene-ruppert-icon.jpg", + "https://evolve.xamarin.com/images/sessions/brent-schooley-icon.jpg", + "https://evolve.xamarin.com/images/sessions/adrian-stevens-icon.jpg", + "https://evolve.xamarin.com/images/sessions/rodrigo-kumpera-icon.jpg", + "https://evolve.xamarin.com/images/sessions/alex-corrado-icon.jpg", + "https://evolve.xamarin.com/images/sessions/jonathan-pryor-icon.jpg", + "https://evolve.xamarin.com/images/sessions/michael-stonis-icon.jpg", + "https://evolve.xamarin.com/images/sessions/jeremie-laval-icon.jpg", + "https://evolve.xamarin.com/images/sessions/james-montemagno-icon.jpg", + "https://evolve.xamarin.com/images/sessions/brett-duncavage-icon.jpg" + }; + + var label = new Label { Text = "I have not been selected" }; + + var listView = new ListView { + ItemsSource = Enumerable.Range (0, albums.Length).Select (i => new { + Text = "Text " + i, + TextColor = i % 2 == 0 ? Color.Red : Color.Blue, + Detail = "Detail " + i, + DetailColor = i % 2 == 0 ? Color.Red : Color.Blue, + Image = albums[i] + }), + ItemTemplate = dataTemplate + }; + + listView.ItemSelected += (sender, args) => label.Text = "I was selected"; + + Content = new StackLayout { Children = { label, listView } }; + + } + } +} |