summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls/GalleryPages/CellsGalleries/TextCellListPage.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Controls/GalleryPages/CellsGalleries/TextCellListPage.cs')
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/CellsGalleries/TextCellListPage.cs48
1 files changed, 48 insertions, 0 deletions
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