Hello,
inside my UI I'm using the XamLinearGauge. There is a binding between the Needle Value and a DataObject.
In case the DataObjects value is higher or lower than the Gauge scale, the Needle will be drawn outside the XamLinearGauge. Is there a possibility to keep the needle inside the Gauge bounds. I tried to do this with the needles "value changed" event:
public void Needle_ValueChanged(object sender, EventArgs e) { LinearGaugeScale sc = this.Gauge.Scales[0]; LinearGaugeNeedle nd = (LinearGaugeNeedle) sender; if (nd.Value > sc.EndValue) { nd.Value = sc.EndValue; } if (nd.Value < sc.StartValue) { nd.Value = sc.StartValue; } }
Unfortunately this isn't working as aspected. By the first value out of scale the needle sticks to the StartValue or the EndValue and won't change in the further proceeding of the program.
Any help would be appreciated.
I have been looking into this and was able to reproduce the behavior you described, however I also wasn’t able to overcome it using the built-in functionality, so I am going to forward this to our development department.
I’ll update you shortly on my progress.
Hello Petar,
thanks for your answer. Right now I am trying to solve this problem using a converter which limits the GaugeNeedle Value:
<ig:LinearGaugeNeedle.Value> <MultiBinding Converter="{StaticResource Double_ScaleBounds}"> <MultiBinding.Bindings> <Binding Path="dataobject.value"/> <Binding Path="dataobject.valueMin"/> <Binding Path="dataobject.valueMax"/> </MultiBinding.Bindings> </MultiBinding> </ig:LinearGaugeNeedle.Value>
-----------------------------------------------------------------------------------------------------------------------------------------Converter:
public class DoubleToScaleBounds : IMultiValueConverter { public object Convert(object[] value, Type targetType, object parameter, CultureInfo culture) { Double v; Double scale_min; Double scale_max; v = (Double) value[0]; scale_min = (Double) value[1]; scale_max = (Double) value[2]; if ( v > scale_max) { v = scale_max; } if ( v < scale_min) { v = scale_min; } return v; }
public object[] ConvertBack(object value, Type[] targetType, object parameter, CultureInfo culture
{
throw new NotSupportedException("Cannot convert back");
}
-----------------------------------------------------------------------------------------------------------------------------------
But in my opinion it would be nice to have "keeping the needle inside the scale" as a built in behaviour.
Hi,
I agree this should be the default behavior for the control, this is why I am logging it with development so they can fix it internally and you can download it with a Service Release.
I'll update you shortly on my progress.
Hi Petar,
that would be great.
Thanks for your help!
have created a support ticket on your behalf with number: CAS-65922-FKK5H8 and I am going to link it to development issue: 77039 , I logged, so that you get automatically update when a Feature Release containing the fix is available for download. You can get the new version from our website’s “My IG”, “My Keys & Downloads” tags: https://es.infragistics.com/Membership/Default.aspx?panel=Downloads#Downloads
You can also monitor the support ticket’s progress through the “My Support Activity” tag: https://es.infragistics.com/Membership/MySupport.aspx