diff options
Diffstat (limited to 'Xamarin.Forms.Controls/GalleryPages/CellsGalleries/EntryCellListPage.cs')
-rw-r--r-- | Xamarin.Forms.Controls/GalleryPages/CellsGalleries/EntryCellListPage.cs | 54 |
1 files changed, 54 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 |