Hi!
Iam trying to use a RadGauge to display two values, CurrentCapacity and MaxCapacity, and I thought a gauge would be a nice way. But my marker on the RadHorizontalLinearGauge does not align correctly.
<telerik:RadHorizontalLinearGauge>
<telerik:HorizontalLinearScale Min="0" Max="10" >
<telerik:HorizontalLinearScale.Indicators>
<telerik:Marker Value="2"></telerik:Marker>
</telerik:HorizontalLinearScale.Indicators>
</telerik:HorizontalLinearScale>
</telerik:RadHorizontalLinearGauge>
Results in:
Notice marker is not on 2. The same problem occurs with different Max and Values.
Do I have some strange style that applies a margin/padding or something?
BarIndicator is not updated when using GaugeRanges and their Min and Max properties are changed at runtime. The indicator's layout is updated only when the gauge control is re-sized. Possible workaround: Update measure and arrange the BarIndicator control manually. var size = this.BarIndicatorRanges1.RenderSize; this.BarIndicatorRanges1.Measure(Size.Empty); this.BarIndicatorRanges1.Measure(size); this.BarIndicatorRanges1.Arrange(new Rect(size)); this.BarIndicatorRanges1.UpdateLayout();
When you resize (but only decreasing size) the control, the position and size of the Marker indicator is not updated.
This is reproducible with RadVerticalLinearGauge and VerticalLinearScale. When the RelativeHeight of the scale is set to 1 and the RelativeY is set to 0.
As a work around you can avoid setting the RelativeHeight and RelativeY properties of VerticalLinearScale.One way to work around this is to include a dummy resource with the name of "HexagonalSevenSegsN" <telerik:RadVerticalLinearGauge> <FrameworkElement.Resources> <DataTemplate x:Key="HexagonalSevenSegsN" /> The same exception is also thrown when you are trying to bind the NumericIndicator Value property when using SevenSegsNumberPosition position. In this scenario, the data context is not propagated to the NumericIndicator. To workaround this you can set the Source binding. <Window.Resources> <local:TestViewModel x:Key="viewModel"/> </Window.Resources> <tk:RadRadialGauge Name="gauge" Height="200" Width="200" Margin="5"> <tk:RadialScale Min="0" Max="300" MajorTicks="10" LabelRotationMode="None"> <tk:RadialScale.Indicators> <tk:NumericIndicator x:Name="numericIndicator" Value="{Binding TestValue,Source={StaticResource viewModel}}"
When the properties are bound in code behind, they are not updated as they are supposed to. Binding them in XAML, by setting the DataContext of the control as StaticResource, works as expected.
The visual elements generated for the GaugeRange objects are not cleared when you clear the Ranges collection of the scale. This happens if you call the Clear() method of the Ranges collection. To work this around you can clear the ranges using the Remove() method instead of clear. while (scale.Ranges.Count > 0) { scale.Ranges.Remove(scale.Ranges.LastOrDefault()); }
When the gauge contains a scale which is interactive (IsInteractive property is true) and when the Gauge control it is embed inside the RadFluidContentControl.LargeContent then it throws an exception. ComException with Message: UCEERR_RENDERTHREADFAILURE. This is reproducible also: - In any control that uses animation transitions to change its content. - If many instances of a gauge control are added in the transition's control content.
When the Effect property of the gauge's scale is set (to BlurEffect for example) any mouse interaction with the control is lost. If the Effect property of the panel that wraps the gauge is set, the mouse interaction of all children of this panel is lost. Workaround: Disable the interaction with the scale and implement the moving of the indicators on MouseLeftButtonDown. Here is an example: <telerik:RadRadialGauge MouseLeftButtonDown="RadRadialGauge_MouseLeftButtonDown" > <telerik:RadialScal Min="1" Max="12" IsInteractive="False"> <telerik:RadialScale.Indicators> <telerik:Needle /> <telerik:Pinpoint /> </telerik:RadialScale.Indicators> </telerik:RadialScale> </telerik:RadRadialGauge> Note that the IsInteractive property's default value is False so you can just skip setting it. private void RadRadialGauge_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { var mousePosition = e.GetPosition(this.rs1); double value = this.rs1.GetValueByPoint(mousePosition); foreach (UIElement element in this.rs1.Indicators) { InteractiveIndicator indicator = element as InteractiveIndicator; if (indicator != null) { indicator.Value = value; } } }
When the Ranges property of scale is bound inside a user control then it causes the "Object reference not set to an instance of an object" exception in the Telerik.Windows.Controls.Gauge.ScaleBase.OnApplyTemplate method. As a workaround you can set the Ranges property to empty GaugeRangeCollection in your user control using the SetCurrentValue method which does not break the databinding. Also it will require to set the Ranges.ItemTemplate property after the scale is loaded.
As a workaround you need to use a ProportionalBrush mode instead.
The Visibility property of GaugeRange is not applied when it is set or bound in xaml As a workaround if you set the Visibility in code after the range is loaded, the property's value is applied correctly.
If the numeric indicator is visualized on a large area (its container has large size), its segments are overlapping.
When the Min and Max properties of the GaugeRange control are updated dynamically, a memory leak occurs, where ObjectRangeInfo elements are created but not released at a later time. The fix is available in LIB Version 2015.2.803.