This is a migrated thread and some comments may be shown as answers.

How to bind BarIndicatorSegment.Length?

4 Answers 93 Views
Gauge
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Michael
Top achievements
Rank 1
Michael asked on 22 Oct 2011, 04:51 PM
Hi

I'm trying to work with RadialGaugeRange and SegmentedRadialGaugeIndicator, with binding to my DataContext.
This works fine, but when I try to bind the BarIndicatorSegment.Length, then I got a "Set property 'Telerik.Windows.Controls.BarIndicatorSegment.Length' threw an exception. [Line: 44 Position: 67]" exception during the LoadComponent-Call (no ready access to my DataContext object happens).

Here my current code snippet. The RadialGaugeRange has a DataContext assigned in the Page Construtor.
Every binding path exists and has valid values. As far as I can see, all other bindings works fine. 

<
telerikDataVisualization:RadialGaugeRange x:Name="gauge" LabelTemplate="{StaticResource TimeLabelTemplate}" TickTemplate="{StaticResource LineTemplate}" CenterMode="CenterCenter" MinAngle="100" MaxAngle="440" MaxValue="{Binding TimeboxDuration, Mode=OneWay}" TickStep="{Binding TimeboxDuration, Converter={StaticResource DurationToIndicatorStep}}" LabelStep="{Binding TimeboxDuration, Converter={StaticResource DurationToLabelStep}}" Margin="10" LabelRadiusScale="0.9">
<telerikDataVisualization:SegmentedRadialGaugeIndicator telerikDataVisualization:RadialGaugeRange.IndicatorRadiusScale="0.6" telerikDataVisualization:RadialGaugeRange.MinAngle="100" telerikDataVisualization:RadialGaugeRange.MaxAngle="440" Value="{Binding TimeboxDuration, Mode=OneWay}" Margin="0" BorderThickness="10" BorderBrush="#FF003200" Padding="90" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch">
<telerikDataVisualization:BarIndicatorSegment Length="{Binding WorkingDuration, FallbackValue=10}" Stroke="Blue" Thickness="50" />
<telerikDataVisualization:BarIndicatorSegment Length="{Binding ReminderDuration, FallbackValue=1}" Stroke="Red" Thickness="50" />
</telerikDataVisualization:SegmentedRadialGaugeIndicator>
<telerikDataVisualization:ArrowGaugeIndicator telerikDataVisualization:RadialGaugeRange.IndicatorRadiusScale="0.75" telerikDataVisualization:RadialGaugeRange.MinAngle="100" telerikDataVisualization:RadialGaugeRange.MaxAngle="440" ArrowBrush="#FF1FDE4B" ArrowTailRadius="5" ArrowThickness="20" Value="{Binding ElapsedTimeDuration, Mode=OneWay}" />
</telerikDataVisualization:RadialGaugeRange >

PS: The FallbackValue is just a try ... but had no influence. 

Anybody any idea what I'm making wrong?

Have a good time
Michael

4 Answers, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 27 Oct 2011, 12:08 PM
Hello Michael,

 Thank you for writing. The reason that you can not bind to the bar indicator segments is that they do not inherit from DependencyObject and their properties are not dependency properties.

Please indicate if this is important for you and we will consider modifying the indicator segments to inherit from DependencyObject.

I am looking forward to your reply.

All the best,
Victor
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Michael
Top achievements
Rank 1
answered on 27 Oct 2011, 12:32 PM
Hi Victor

Thanks for your answer.

It would be very nice to have the possibility to define the layout with data binding. For my current project I intended to use dynamic gauge layouts.

At the moment I have to make hard-coded design.
Is it possible to access the segements from code behind, so that I can make a workaround?

Greetings
Michael
0
Georgi
Telerik team
answered on 01 Nov 2011, 11:01 AM
Hi Michael,

Thanks for getting back to us.

You can access the segment in code behind like:

BarIndicatorSegment segment = (this.gauge.Indicators[0] as SegmentedGaugeIndicator).Segments[0];

We have not implemented the segments as dependency objects for the sake of performance. The value look-up of dependency properties is times slower compared to a standard CLR property. Additionally, the more dependency properties are declared the slower the loading time is due to all the static metadata initialization. Anyways, we can perform some field-caching to keep performance untouched while having dependency properties and bindings. We will do our best to implement this either for the upcoming Q3 or for the first service pack after it.

Thank you for your feedback and for the feature request - I have updated your Telerik points for your time. Do not hesitate to write us back should you have any question/problem with our tools.

Kind regards,
Georgi
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Michael
Top achievements
Rank 1
answered on 05 Nov 2011, 03:36 PM
I wrapped now everything inside a CustomControl, made own properties for the segment length values and do the segment update in code behind. That works good.

Thanks.

(I tried to access the segments by xaml-name ... that was not the right way ;-))
Tags
Gauge
Asked by
Michael
Top achievements
Rank 1
Answers by
Victor
Telerik team
Michael
Top achievements
Rank 1
Georgi
Telerik team
Share this question
or