forked from syncfusion/xamarin-demos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ContactForm.cs
80 lines (67 loc) · 2.75 KB
/
ContactForm.cs
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#region Copyright Syncfusion Inc. 2001-2021.
// Copyright Syncfusion Inc. 2001-2021. All rights reserved.
// Use of this code is subject to the terms of our license.
// A copy of the current license can be obtained at any time by e-mailing
// [email protected]. Any infringement will be prosecuted under
// applicable laws.
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Foundation;
using UIKit;
using Syncfusion.iOS.DataForm;
using CoreGraphics;
namespace SampleBrowser
{
public class ContactForm : SampleView
{
#region Fields
SfDataForm dataForm;
UITableView tableView;
UIButton button;
DataFormController dataFormController;
#endregion
UIView uIView;
public ContactForm()
{
dataForm = new SfDataForm();
dataForm.LayoutManager = new DataFormLayoutManagerExt(dataForm);
tableView = new UITableView();
tableView.RowHeight = 50;
tableView.SeparatorColor = UIColor.Clear;
dataFormController = new DataFormController(dataForm, tableView);
tableView.Source = new ContactTableSource(dataFormController, new ListViewGroupingViewModel().ContactsInfo);
this.AddSubview(tableView);
button = new UIButton();
uIView = new UIView();
uIView.AddSubview(button);
uIView.BackgroundColor = UIColor.FromRGB(242.0f / 255.0f, 242.0f / 255.0f, 242.0f / 255.0f);
button.SetTitle("Add", UIControlState.Normal);
button.SetTitleColor(this.TintColor, UIControlState.Normal);
button.TouchDown += Button_TouchDown;
this.AddSubview(this.tableView);
this.AddSubview(uIView);
}
private void Button_TouchDown(object sender, EventArgs e)
{
var navigationController = UIApplication.SharedApplication.KeyWindow.RootViewController as UINavigationController;
dataFormController.refreshLayout = false;
dataFormController.UpDateDataFormView(new ContactInfo(), true);
dataFormController.UpdateView();
navigationController.PushViewController(dataFormController, false);
}
public override void LayoutSubviews()
{
button.Frame = new CGRect(this.Frame.Width - 100, 0, 100, 50);
uIView.Frame = (new CGRect(0, 0, this.Frame.Width, 50));
this.tableView.Frame = new CGRect(0, uIView.Bounds.Height, this.Frame.Width, this.Frame.Height - 50);
base.LayoutSubviews();
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
}
}