Radial Gauge/Radial Scale - Labels won't dynamically size when Gauge is placed in ViewBox

1 Answer 20 Views
Gauges
Steven
Top achievements
Rank 1
Steven asked on 24 Jun 2025, 12:30 AM

I have placed a RadialGauge with RadialScale inside a ViewBox.  To get the RadialGauge to display correctly, I have bound the height and width of the RadialGauge to the actual height and width of the the Grid that holds the RadialGauge.  The RadialGauge sizes correctly to the ViewBox although the labels actually get smaller as the Viewbox stretches to fill the window it is in. How do I get the  Indicator label size to change when the size of the ViewBox is changed?

<Window x:Class="GaugeTest.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
        xmlns:local="clr-namespace:GaugeTest"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800" x:Name="TheWindow"
        >
    <Grid Margin="0" x:Name="MainV" >
        <Viewbox x:Name="VBox" 
                HorizontalAlignment="Center" VerticalAlignment="Center"                    
                Stretch="Uniform">

            <telerik:RadRadialGauge Height="{Binding ElementName=MainV, Path=ActualHeight}" Width="{Binding ElementName=MainV, Path=ActualWidth}">
                <telerik:RadialScale   Radius="1"  
                    Min="0" 
                    Max="30"
                    MajorTickStep="5"
                    Foreground="Black"
                             Stroke="Black"
                             StrokeThickness="1"
                             Fill="White"                 
                             >
                    <telerik:RadialScale.Indicators >
                        <telerik:Needle Name="needle" Foreground="Black" Value="15" />
                        <telerik:Pinpoint Foreground="Black"/>
                    </telerik:RadialScale.Indicators>

                </telerik:RadialScale>
            </telerik:RadRadialGauge>
        </Viewbox>
    </Grid>
</Window>
 

1 Answer, 1 is accepted

Sort by
1
Accepted
Martin Ivanov
Telerik team
answered on 26 Jun 2025, 12:00 PM

Hello Steven,

In the current setup where the Width and Height of the control in the Viewbox (the gauge in this case) match tha parent element (the Grid panel), the view box behavior won't kick-in. The resizing you see come from the bindings to the ActualHeight and the ActualWidth and not the viewbox layout system. This is why the labels size is not changed. 

To achieve your requirement, you can set a fixed Width and Height to the gauge control and let the Viewbox to handle the sizing.

  <telerik:RadRadialGauge Height="300" Width="300">

Regards,
Martin Ivanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Gauges
Asked by
Steven
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or