How to bind BarIndicatorSegment.Length?

5 posts, 0 answers
  1. Michael
    Michael avatar
    3 posts
    Member since:
    May 2011

    Posted 22 Oct 2011 Link to this post


    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: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
  2. Victor
    Victor avatar
    1349 posts

    Posted 27 Oct 2011 Link to this post

    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,
    the Telerik team

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

  3. DevCraft banner
  4. Michael
    Michael avatar
    3 posts
    Member since:
    May 2011

    Posted 27 Oct 2011 Link to this post

    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?

  5. Georgi
    Georgi avatar
    296 posts

    Posted 01 Nov 2011 Link to this post

    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,
    the Telerik team

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

  6. Michael
    Michael avatar
    3 posts
    Member since:
    May 2011

    Posted 05 Nov 2011 Link to this post

    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.


    (I tried to access the segments by xaml-name ... that was not the right way ;-))
Back to Top
DevCraft banner