Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > Gauges > Can't resize the Marker

Answered Can't resize the Marker

Feed from this thread
  • Anton avatar

    Posted on Jan 11, 2012 (permalink)

    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!

    Reply

  • Answer Andrey Andrey admin's avatar

    Posted on Jan 16, 2012 (permalink)

    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 >>

    Reply

  • Anton avatar

    Posted on Jan 16, 2012 (permalink)

    Спасибо большое, Андрей!

    Reply

  • James avatar

    Posted on Feb 17, 2012 (permalink)

    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>

    Reply

  • Andrey Andrey admin's avatar

    Posted on Feb 22, 2012 (permalink)

    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 >>

    Reply

  • James avatar

    Posted on Feb 22, 2012 (permalink)

    Thanks Andrey!  That is working perfectly now.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WPF > Gauges > Can't resize the Marker
Related resources for "Can't resize the Marker"

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