public CircleSliderSurfaceItemImplements(CircleSliderSurfaceItem item, EvasObject parent, CircleSurface surface) : base(parent, surface) { _item = item; item.PropertyChanged += ItemPropertyChanged; ValueChanged += OnValueChanged; BackgroundAngle = item.BackgroundAngle; BackgroundAngleOffset = item.BackgroundAngleOffset; if (item.BackgroundColor != default(Xamarin.Forms.Color)) { BackgroundColor = item.BackgroundColor.ToNative(); } if (item.BackgroundLineWidth != -1) { BackgroundLineWidth = item.BackgroundLineWidth; } if (item.BackgroundRadius != -1) { BackgroundRadius = item.BackgroundRadius; } BarAngle = item.BarAngle; BarAngleOffset = item.BarAngleOffset; BarAngleMaximum = item.BarAngleMaximum; BarAngleMinimum = item.BarAngleMinimum; if (item.BarColor != default(Xamarin.Forms.Color)) { BarColor = item.BarColor.ToNative(); } if (item.BarLineWidth != -1) { BarLineWidth = item.BarLineWidth; } if (item.BarRadius != -1) { BarRadius = item.BarRadius; } Minimum = item.Minimum; Maximum = item.Maximum; Step = item.Increment; Value = item.Value; IsEnabled = item.IsEnabled; if (item.IsVisible) { Show(); } else { Hide(); } }
public TCCircleSliderSurfaceItem2() { InitializeComponent(); _slider1 = new CircleSliderSurfaceItem { BackgroundColor = Color.Blue, BackgroundRadius = 170, BackgroundLineWidth = 20, BackgroundAngleOffset = 90, BackgroundAngle = 270, BarColor = Color.Red, BarRadius = 170, BarLineWidth = 18, BarAngleOffset = 90, BarAngleMaximum = 180, BarAngleMinimum = 10, Increment = 1, Value = 1, }; _slider2 = new CircleSliderSurfaceItem { BackgroundColor = Color.LightGray, BackgroundRadius = 140, BackgroundLineWidth = 15, BarColor = Color.Green, BarRadius = 140, BarLineWidth = 13, Maximum = 6, Minimum = 1, Increment = 0.5, Value = 3, }; label1.SetBinding(Label.TextProperty, "Value", BindingMode.Default, new ValueConverter1()); label2.SetBinding(Label.TextProperty, "Value", BindingMode.Default, new ValueConverter2()); label1.BindingContext = _slider1; label2.BindingContext = _slider2; CircleSurfaceItems.Add(_slider1); CircleSurfaceItems.Add(_slider2); _focusedItem = "slider1"; RotaryFocusObject = _slider1; }