-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
MvxStandardTableViewCell.cs
76 lines (63 loc) · 2.45 KB
/
MvxStandardTableViewCell.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
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MS-PL license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Windows.Input;
using Foundation;
using MvvmCross.Binding.Bindings;
using ObjCRuntime;
using UIKit;
namespace MvvmCross.Platforms.Ios.Binding.Views
{
public class MvxStandardTableViewCell
: MvxTableViewCell
{
public MvxStandardTableViewCell(NativeHandle handle)
: this("TitleText" /* default binding is ToString() on the passed in item */, handle)
{
}
public MvxStandardTableViewCell(string bindingText, NativeHandle handle)
: base(bindingText, handle)
{
}
public MvxStandardTableViewCell(IEnumerable<MvxBindingDescription> bindingDescriptions, NativeHandle handle)
: base(bindingDescriptions, handle)
{
}
public MvxStandardTableViewCell(string bindingText, UITableViewCellStyle cellStyle, NSString cellIdentifier,
UITableViewCellAccessory tableViewCellAccessory = UITableViewCellAccessory.None)
: base(bindingText, cellStyle, cellIdentifier, tableViewCellAccessory)
{
}
public MvxStandardTableViewCell(IEnumerable<MvxBindingDescription> bindingDescriptions,
UITableViewCellStyle cellStyle, NSString cellIdentifier,
UITableViewCellAccessory tableViewCellAccessory = UITableViewCellAccessory.None)
: base(bindingDescriptions, cellStyle, cellIdentifier, tableViewCellAccessory)
{
}
public string TitleText
{
get { return TextLabel.Text; }
set { TextLabel.Text = value; }
}
public string DetailText
{
get { return DetailTextLabel.Text; }
set { DetailTextLabel.Text = value; }
}
public ICommand SelectedCommand { get; set; }
private bool _isSelected;
public override void SetSelected(bool selected, bool animated)
{
base.SetSelected(selected, animated);
if (_isSelected == selected)
return;
_isSelected = selected;
if (_isSelected)
{
SelectedCommand?.Execute(null);
}
}
}
}