- Home
- Forum
- Xamarin.Forms
- Circular Gauge binding problems
Circular Gauge binding problems
It doesn't seem like binding to StartValue / EndValue for both Scales and multiple Ranges really works. I dont see them having any effect. I have a scenario where the bounds of the gauge need to change dynamically - basically the viewmodel tracks the min and max values seen and I want the extents of the gauge to track these, so that the needle is always in the middle. If I bind to StartValue / EndValue nothing happens when I change the properties in my viewmodel.
I have other properties bound (StartValue / EndValue on a single range when the scale has fixed start/end seems to work) so it isn't a vm problem.
If I hook my view up to the propertychanged event of my viewmodel directly, I'm able to set startvalue/endvalue on the scale and 2nd range just fine, but this is ugly and not MVVM. I saw a prior thread from 2013 relating to the winrt controls, so maybe there's something similar going on here.
Here is my creation code
_radialGauge =
new SfCircularGauge
{
GaugeType = GaugeType.North
};
_scale =
new Scale
{
StartValue = 0,
StartAngle = 200,
SweepAngle = 140,
EndValue = 20, //DefaultAutoMax, //20,
ShowRim = false,
MajorTickSettings =
new TickSettings
{
Color = Color.FromRgba(128, 128, 128, 128),
Length = 200,
Offset = 0.08
},
MinorTicksPerInterval = 1,
MinorTickSettings =
new TickSettings
{
Color = Color.FromRgba(200, 200, 200, 128),
Length = 200,
Offset = 0.08,
},
Interval = 1.0,
//NumberOfDecimalDigits = 3,
LabelColor = CurrentTheme.ColorScheme.Gray50,
LabelOffset = 0,
LabelFontSize = 20, //known issue - this has no effect until next update
};
//_scale.SetBinding(Syncfusion.SfGauge.XForms.Scale.StartValueProperty, "RangeStart");
//_scale.SetBinding(Syncfusion.SfGauge.XForms.Scale.EndValueProperty, "RangeEnd");
//_scale.SetBinding(Syncfusion.SfGauge.XForms.Scale.IntervalProperty, "RangeInterval");
var pointer =
new NeedlePointer
{
Color = Color.FromRgb(228, 56, 130),
KnobColor = this.BackgroundColor,
KnobRadius = 400,
LengthFactor = 0.98,
EnableAnimation = false
};
pointer.SetBinding(NeedlePointer.ValueProperty, "Current");
_scale.Pointers.Add(pointer);
_backRange =
new Range
{
Color = Color.FromRgb(239, 227, 211),
Thickness = 220,
Offset = 0.05,
StartValue = 0,// scale.StartValue,
EndValue = _scale.EndValue//DefaultAutoMax,// scale.EndValue
};
//_backRange.SetBinding(Range.StartValueProperty, "RangeStart");
//_backRange.SetBinding(Range.EndValueProperty, "RangeEnd");
_scale.Ranges.Add(_backRange);
var range =
new Range
{
Color = Color.FromRgb(178, 216, 239),
Thickness = 220,
Offset = 0.05
};
range.SetBinding(Range.StartValueProperty, "Minimum");
range.SetBinding(Range.EndValueProperty, "Maximum");
_scale.Ranges.Add(range);
_radialGauge.Scales.Add(_scale);
SIGN IN To post a reply.
2 Replies
DW
Derrick Willer
November 29, 2015 10:43 PM UTC
LinearRange bindings for StartValue / EndValue in a LinearGauge don't appear to work either.
Even if I manually bind to property changing and try to directly update the values, the displayed range is never changed.
NM
Nijamudeen Mohamed Sulaiman
Syncfusion Team
November 30, 2015 10:32 AM UTC
Hi Derrick,
Thanks for your interest in Syncfusion products.
We have created a separate incidents for this query, please login to below location to have follow up regarding this query.
Link: https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents
Please let us know if you have any concern.
Regards,
Nijamudeen M.
SIGN IN To post a reply.
- 2 Replies
- 2 Participants
-
DW Derrick Willer
- Nov 29, 2015 07:24 PM UTC
- Nov 30, 2015 10:32 AM UTC