Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > Gauges > Custom label inside RadRadialGauge

Answered Custom label inside RadRadialGauge

Feed from this thread
  • nCubed avatar

    Posted on Dec 7, 2011 (permalink)

    In reviewing the post How do i make a label inside a gauge? it appears that the code sample may be for a previous version of the Gauge?

    The sample does appear to sort of work by importing the 
    clr-namespace:Telerik.Windows.Controls.Gauges;assembly=Telerik.Windows.Controls.Gauge
    namespace. However, the label location is always at the top left of the UserControl the RadRadialGauge is contained within.

    Is there an updated sample that demonstrates how to use a custom label inside a gauge that will scale when the gauge is resized?

    Thanks!

    Reply

  • Answer Andrey Andrey admin's avatar

    Posted on Dec 12, 2011 (permalink)

    Hello Ncubed,

    The new version of the gauge control allows positioning of any FrameworkElement over the gauge using relative measurements. To do it you should put a desirable element (TextBlock, for example) to the CustomItems property of the scale object:

    <telerik:RadRadialGauge>
        <telerik:RadialScale Name="scale">
            <telerik:RadialScale.Indicators>
                <telerik:Marker Name="marker"
                        telerik:ScaleObject.Location="OverCenter"
                        UseRangeColor="True"
                        IsAnimated="True"
                        Value="60" />
            </telerik:RadialScale.Indicators>
     
            <telerik:RadialScale.CustomItems>
                <TextBlock Text="12345"
                       HorizontalAlignment="Center"
                       telerik:ScaleObject.RelativeX="0.5"
                       telerik:ScaleObject.RelativeY="0.2" />
                     
                <TextBlock Text="C"
                       telerik:ScaleObject.Location="Inside"
                       telerik:ScaleObject.Offset="0.2"
                       telerik:ScaleObject.Value="20"
                       telerik:RadialScale.RotationMode="SurroundOut" />
                         
            </telerik:RadialScale.CustomItems>
        </telerik:RadialScale>
    </telerik:RadRadialGauge>

    There are 2 ways of the positioning using relative measurement:
    1. Using ScaleObject.RelativeX and ScaleObject.RelativeY attached properties. These 2 properties set X and Y coordinates of the object using relative measurement.
    2. Using ScaleObject.Value, ScaleObject.Location and ScaleObject.Offset attached properties. The ScalObject.Value property specify the value along the scale where put the object. The ScaleObject.Location and ScaleObject.Offset specify object location relative to the scale bar boundaries and offset from this location.

    You can use Use Canvas.ZIndex attached property to position object over or under some scale elements. The scale objects have following default ZIndex:
    1. Range – 100
    2. Tick mark – 200
    3. Label – 300
    4. Indicator – 400

    Best wishes,
    Andrey Murzov
    the Telerik team

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

    Reply

  • nCubed avatar

    Posted on Dec 14, 2011 (permalink)

    Hello Andrey,

    Thank you for the example and the detailed explanation of the attached properties. Everything works well and as expected.

    Cheers!

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > Gauges > Custom label inside RadRadialGauge
Related resources for "Custom label inside RadRadialGauge"

WPF Gauge Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  ]