-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSolidBackgroundButton.cs
More file actions
85 lines (73 loc) · 2.07 KB
/
SolidBackgroundButton.cs
File metadata and controls
85 lines (73 loc) · 2.07 KB
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
81
82
83
84
85
using System;
using System.ComponentModel;
using CoreGraphics;
using Foundation;
using UIKit;
namespace XamarinApp.Ios
{
[Register("SolidBackgroundButton"), DesignTimeVisible(true)]
public class SolidBackgroundButton : UIButton
{
private UIColor backgroundColorHighlight;
private UIColor backgroundColorNormal;
private bool highlighted;
[Export("BackgroundColorNormal"), Browsable(true)]
public UIColor BackgroundColorNormal
{
get { return backgroundColorNormal; }
set
{
backgroundColorNormal = value;
SetNeedsDisplay();
}
}
[Export("BackgroundColorHightlight"), Browsable(true)]
public UIColor BackgroundColorHighlight
{
get { return backgroundColorHighlight; }
set
{
backgroundColorHighlight = value;
SetNeedsDisplay();
}
}
public override bool Highlighted
{
get { return highlighted; }
set
{
highlighted = value;
BackgroundColor = highlighted ? BackgroundColorHighlight : BackgroundColorNormal;
}
}
public SolidBackgroundButton(UIButtonType type) : base(type)
{
Initialize();
}
public SolidBackgroundButton()
{
Initialize();
}
public SolidBackgroundButton(NSCoder coder) : base(coder)
{
Initialize();
}
protected SolidBackgroundButton(NSObjectFlag t) : base(t)
{
Initialize();
}
protected internal SolidBackgroundButton(IntPtr handle) : base(handle)
{
Initialize();
}
public SolidBackgroundButton(CGRect frame) : base(frame)
{
Initialize();
}
private void Initialize()
{
BackgroundColorNormal = UIColor.White;
BackgroundColorHighlight = UIColor.FromRGB(241, 241, 241);
}
}
}