forked from syncfusion/xamarin-demos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDefault.cs
98 lines (82 loc) · 2.99 KB
/
Default.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#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
// licensing@syncfusion.com. Any infringement will be prosecuted under
// applicable laws.
#endregion
using System;
#if __UNIFIED__
using Foundation;
using UIKit;
using CoreGraphics;
#else
using MonoTouch.Foundation;
using MonoTouch.UIKit;
using MonoTouch.CoreGraphics;
using nint = System.Int32;
using nuint = System.Int32;
using CGSize = System.Drawing.SizeF;
using CGRect = System.Drawing.RectangleF;
using nfloat = System.Single;
#endif
using Syncfusion.SfGauge.iOS;
namespace SampleBrowser
{
public class Default : SampleView
{
SFLinearGauge linearGauge;
static bool UserInterfaceIdiomIsPhone
{
get { return UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Phone; }
}
#region View lifecycle
public override void LayoutSubviews()
{
foreach (var view in this.Subviews)
{
view.Frame = Bounds;
linearGauge.Frame = new CGRect(0, 30, this.Frame.Size.Width, this.Frame.Size.Height - 30);
}
base.LayoutSubviews();
}
public Default()
{
//LinearGauge
this.BackgroundColor = UIColor.White;
linearGauge = new SFLinearGauge();
linearGauge.BackgroundColor = UIColor.White;
linearGauge.Header = new SFLinearLabel();
SFLinearScale scale = new SFLinearScale();
scale.Minimum = 0;
scale.Maximum = 100;
scale.Interval = 10;
scale.ScaleBarSize = 2;
scale.OpposedPosition = true;
scale.LabelColor = UIColor.FromRGB(66, 66, 66);
scale.LabelFont = UIFont.FromName("Helvetica", 14f);
scale.MinorTicksPerInterval = 4;
scale.ScaleBarColor = UIColor.FromRGB(158, 158, 158);
SFLinearTickSettings major = new SFLinearTickSettings();
major.Thickness = 1.5f;
major.Length = 30;
major.Color = UIColor.FromRGB(158, 158, 158);
scale.MajorTickSettings = major;
SFLinearTickSettings minor = new SFLinearTickSettings();
minor.Thickness = 0.9f;
minor.Color = UIColor.FromRGB(158, 158, 158);
minor.Length = 15;
scale.MinorTickSettings = minor;
SFSymbolPointer pointer = new SFSymbolPointer();
pointer.SymbolPosition = SymbolPointerPosition.Away;
pointer.Thickness = 12;
pointer.Value = 10;
pointer.Color = UIColor.FromRGB(158, 158, 158);
pointer.MarkerShape = MarkerShape.Triangle;
scale.Pointers.Add(pointer);
linearGauge.Scales.Add(scale);
this.AddSubview(linearGauge);
}
#endregion
}
}