1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Xamarin.Forms.Controls
{
public class SettingsPage : ContentPage
{
SettingsScreen _settingsScreen;
public SettingsPage ()
{
_settingsScreen = new SettingsScreen ();
Content = _settingsScreen;
}
}
public class SettingsScreen : TableView
{
public SettingsScreen ()
{
Intent = TableIntent.Settings;
var cell = new TextCell { Text = "Coverflow", Detail = "Value 1" };
var boolCell = new SwitchCell { Text = "Off" };
boolCell.OnChanged += (sender, arg) => boolCell.Text = boolCell.On ? "On" : "Off";
var root = new TableRoot () {
new TableSection () {
cell,
new TextCell { Text = "Cell 2", Detail = "Value 2" },
new EntryCell {
Label = "Label",
Placeholder = "Placeholder 1",
HorizontalTextAlignment = TextAlignment.Center,
Keyboard = Keyboard.Numeric
},
new ImageCell { Text = "Hello", Detail = "World", ImageSource = "cover1.jpg" }
},
new TableSection ("Styles") {
boolCell,
new EntryCell {
Label = "Label2",
Placeholder = "Placeholder 2",
HorizontalTextAlignment = TextAlignment.Center,
Keyboard = Keyboard.Chat
},
},
new TableSection ("Custom Cells") {
new ViewCell { View = new Button (){ Text = "Hi" } },
}
};
Root = root;
}
}
}
|