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

Custom label inside RadRadialGauge

4 Answers 368 Views
Gauges
This is a migrated thread and some comments may be shown as answers.
nCubed
Top achievements
Rank 1
nCubed asked on 08 Dec 2011, 02:27 AM
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!

4 Answers, 1 is accepted

Sort by
0
Accepted
Andrey
Telerik team
answered on 12 Dec 2011, 11:41 AM
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 >>

0
nCubed
Top achievements
Rank 1
answered on 14 Dec 2011, 06:32 PM
Hello Andrey,

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

Cheers!
0
Kalaivanan
Top achievements
Rank 1
answered on 24 Mar 2015, 09:23 AM
how can use the Guage controls in Windows Forms...     
0
Milena
Telerik team
answered on 25 Mar 2015, 09:03 AM
Hi Kalaivanan,

It is possible to host WPF control inside Windows Forms application. In order to achieve this you should:
- add reference to WindowsFormsIntegration and System.Xml dll in your project 
- add WPF UserContol in your project (with the RadGauge for instance)
- add ElementHost in your WinForm where you can host a WPF UserControl

For your convenience I implemented this approach in the attached project. You can take a look at it and see if it works for you.

Moreover, if you write Windows Forms application you can take a look at our UI for WinForms. Since last year we added RadialGauge and LinearGauge to our suite for WinForms UI controls. 

Lastly I would ask you to keep the communication for a particular topic in a single thread. (the topic of this forum post is "Custom label inside RadRadialGauge"). This way we will be able to track the issue easier, organize our communication history better and assist you in a more convenient manner. We appreciate your understanding in this matter. 

I hope this information will help you and don't hesitate to write back if you have more questions.

Regards,
Milena
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
Gauges
Asked by
nCubed
Top achievements
Rank 1
Answers by
Andrey
Telerik team
nCubed
Top achievements
Rank 1
Kalaivanan
Top achievements
Rank 1
Milena
Telerik team
Share this question
or