Can't resize the Marker

6 posts, 1 answers
  1. Anton
    Anton avatar
    2 posts
    Member since:
    Jan 2012

    Posted 11 Jan 2012 Link to this post

    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!

  2. Answer
    Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 16 Jan 2012 Link to this post

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

  3. UI for WPF is Visual Studio 2017 Ready
  4. Anton
    Anton avatar
    2 posts
    Member since:
    Jan 2012

    Posted 16 Jan 2012 Link to this post

    Спасибо большое, Андрей!
  5. James
    James avatar
    44 posts
    Member since:
    Jan 2012

    Posted 17 Feb 2012 Link to this post

    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>

  6. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 22 Feb 2012 Link to this post

    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 >>
  7. James
    James avatar
    44 posts
    Member since:
    Jan 2012

    Posted 22 Feb 2012 Link to this post

    Thanks Andrey!  That is working perfectly now.
Back to Top
UI for WPF is Visual Studio 2017 Ready