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

Can't resize the Marker

5 Answers 45 Views
Gauges
This is a migrated thread and some comments may be shown as answers.
Anton
Top achievements
Rank 1
Anton asked on 11 Jan 2012, 01:11 PM

Hi!

I'm using Linear Gauge in my full screen project, for example, it looks like this:

<telerik:RadVerticalLinearGauge x:Name="linearGauge" Width="100" Height="300">
            <telerik:LinearScale x:Name="linearScale" Min="1" Max="12" >
                <telerik:LinearScale.Indicators>
                    <telerik:Marker x:Name="indicator" Value="5"/>
                </telerik:LinearScale.Indicators>
            </telerik:LinearScale>
        </telerik:RadVerticalLinearGauge>

I've understand how to scale the gauge, but I can't scale the marker. Method with changing RelativeHeight value I've found in help does'n work - the error is "The property 'RelativeHeight' was not found in type 'Marker'". Styling doesn't work either.  Please help!


Thanks!

5 Answers, 1 is accepted

Sort by
0
Accepted
Andrey
Telerik team
answered on 16 Jan 2012, 08:40 AM
Hello,

You can change the size of the marker using the ScaleObject.RelativeWidth and ScaleObject.RelativeHeight attachable properties. The sample code is below.
<telerik:Marker x:Name="indicator"
            telerik:ScaleObject.RelativeWidth="0.25"
            telerik:ScaleObject.RelativeHeight="0.05"
            Value="5"/>

Regards,
Andrey Murzov
the Telerik team

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

0
Anton
Top achievements
Rank 1
answered on 16 Jan 2012, 10:34 AM
Спасибо большое, Андрей!
0
James
Top achievements
Rank 1
answered on 17 Feb 2012, 03:24 PM
Is there any way to have the marker re-position itself in the scale when the RelativeHeight and RelativeWidth properties are changed?  Currently when I make the change the marker will re-size  but it will not correctly recenter as the Location property is set to OverCenter.  The following code shows how I am using the marker in this instance.  The version that I am using is 2011.2.712.35.

<ControlTemplate x:Key="Marker" TargetType="telerik:Marker"  >
    <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <Polygon Fill="{TemplateBinding Control.Background}" Points="0,5 20,0 35,0 35,10 20,10" Stretch="Uniform" Stroke="{TemplateBinding Control.BorderBrush}" StrokeThickness="{TemplateBinding Control.BorderThickness}" />
    </Grid>
</ControlTemplate>

<Grid Name="layoutRoot" Height="348" Width="500">
    <telerik:RadGauge>
        <telerik:LinearGauge x:Name="linearGauge" Width="100" Height="300">
            <telerik:LinearScale x:Name="linearScale" Min="0" Max="10" Orientation="Vertical" EndWidth="0.05" StartWidth="0.05" MinorTicks="2" MajorTicks="10" Location="OverCenter">
                <telerik:LinearScale.MajorTick><telerik:MajorTickProperties Location="OverCenter" /></telerik:LinearScale.MajorTick>
                <telerik:LinearScale.MiddleTick><telerik:MiddleTickProperties Location="OverCenter" /></telerik:LinearScale.MiddleTick>
                <telerik:LinearScale.MinorTick><telerik:MinorTickProperties Location="OverCenter" /></telerik:LinearScale.MinorTick>
                <telerik:LinearScale.Label>
                    <telerik:LabelProperties Location="Inside"></telerik:LabelProperties>
                </telerik:LinearScale.Label>
                <telerik:IndicatorList>
                    <telerik:LinearBar Value="6" Location="OverCenter" />
                    <telerik:Marker Value="6" Template="{StaticResource Marker}" RelativeHeight=".12" RelativeWidth=".13" Location="OverCenter" />
                </telerik:IndicatorList>
            </telerik:LinearScale>
        </telerik:LinearGauge>
    </telerik:RadGauge>
</Grid>

0
Andrey
Telerik team
answered on 22 Feb 2012, 09:26 AM
Hello James,

When you change these properties dynamically then you can use the InvalidateArrange method of the scale for recalculation of the marker's location.
The sample code is below.
private void Button_Click(object sender, RoutedEventArgs e)
{
    this.marker.RelativeWidth = 0.3;
    this.linearScale.InvalidateArrange();
}

Also I should note that in the 2011.Q3 release we introduced a new gauge control. It is almost a new control redesigned from scratch. Some of its features are similar to the old control’s features but they are implemented in absolutely different way (using different set of properties), some features are completely new.
Our demo application now references the new gauge control and demonstrates its features.
We strongly recommend using of the new gauge control in the new applications. We also would recommend replacing the old control with new one in existing applications if there is a timeframe for this task.

Regards,
Andrey Murzov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
James
Top achievements
Rank 1
answered on 22 Feb 2012, 04:39 PM
Thanks Andrey!  That is working perfectly now.
Tags
Gauges
Asked by
Anton
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Anton
Top achievements
Rank 1
James
Top achievements
Rank 1
Share this question
or