-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathCustomCell.cs
More file actions
45 lines (39 loc) · 1.4 KB
/
Copy pathCustomCell.cs
File metadata and controls
45 lines (39 loc) · 1.4 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
using Android.Content;
using Android.Graphics;
using Android.Util;
using Android.Views;
using DevExpress.XamarinAndroid.Scheduler.Visual.Data;
namespace CustomDayViewProviders.Droid {
public class CustomCell : View {
CellViewInfo viewInfo;
Paint borderPaint;
Color backColor;
public CustomCell(Context context)
: base(context) {
}
public CellViewInfo ViewInfo {
get { return this.viewInfo; }
set {
if (this.viewInfo == value)
return;
this.viewInfo = value;
this.backColor = new Color(ViewInfo.BackColor);
this.borderPaint = new Paint(PaintFlags.AntiAlias) { Color = new Color(ViewInfo.BottomBorderColor) };
}
}
protected override void OnDraw(Canvas canvas) {
canvas.DrawColor(this.backColor);
DrawLeftBorder(canvas);
DrawBottomBorder(canvas);
}
void DrawLeftBorder(Canvas canvas) {
int leftBorder = ViewInfo.BorderThickness[0];
canvas.DrawRect(0, 0, leftBorder, Height, this.borderPaint);
}
void DrawBottomBorder(Canvas canvas) {
int borderHeight = ViewInfo.BorderThickness[3];
int top = Height - borderHeight;
canvas.DrawRect(0, top, Width, top + borderHeight, this.borderPaint);
}
}
}