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

Setting NumericIndicator's Positions property via style

1 Answer 57 Views
Gauges
This is a migrated thread and some comments may be shown as answers.
J
Top achievements
Rank 1
J asked on 10 Mar 2018, 01:21 PM

Is it possible to set the Positions property using a style?

Here's mine:

<Style x:Key="myStyle" TargetType="telerik:NumericIndicator" BasedOn="{StaticResource {x:Type telerik:NumericIndicator}}">
    <Setter Property="telerik:ScaleObject.Location" Value="Inside"/>
    <Setter Property="telerik:ScaleObject.RelativeX" Value="0.225"/>
    <Setter Property="telerik:ScaleObject.RelativeY" Value="0.4"/>
    <Setter Property="telerik:ScaleObject.RelativeHeight" Value="0.4*"/>
    <Setter Property="telerik:ScaleObject.RelativeWidth" Value="1.1*"/>
    <Setter Property="Foreground" Value="#FFCED2E4"/>  
    <Setter Property="Format" Value="{}{0:F1}"/>
    <Setter Property="Positions">
        <Setter.Value>
            <telerik:NumberPositionCollection>
                <telerik:FontNumberPosition CornerRadius="15,0,0,15" />
                <telerik:FontNumberPosition/>
                <telerik:FontNumberPosition/>
                <telerik:FontNumberPosition/>
                <telerik:FontNumberPosition/>
                <telerik:FontNumberPosition/>
                <telerik:FontNumberPosition CornerRadius="0,15,15,0"/>
            </telerik:NumberPositionCollection>
        </Setter.Value>
    </Setter>
</Style>

 

Doesn't seem to work. The NumericIndicator is aligned ok (I can see the rectangle positioned correctly in VS designer) but there are no visible NumberPosition objects.

Properties window shows that the Positions property value is an empty collection, and the little rectangle (after the "..." button) is gray. I.e., not indicating that the Positions property is bound to anything.

1 Answer, 1 is accepted

Sort by
0
Vladimir Stoyanov
Telerik team
answered on 14 Mar 2018, 02:54 PM
Hello,

Thank you for the provided xaml. 

I am afraid that currently setting the Positions property of NumericIndicator through a style is not supported. I logged in a feature request in our feedback portal: 
Implement support for the Positions property of NumericIndicator set through style. I also updated your telerik points for bringing this to our attention. 

For the time being you can directly set the Positions property of the NumericIndicator like so:
<telerik:NumericIndicator >
                <telerik:FontNumberPosition CornerRadius="15,0,0,15" />
                <telerik:FontNumberPosition/>
                <telerik:FontNumberPosition/>
                <telerik:FontNumberPosition/>
                <telerik:FontNumberPosition/>
                <telerik:FontNumberPosition/>
                <telerik:FontNumberPosition CornerRadius="0,15,15,0"/>
</telerik:NumericIndicator>

Regards,
Vladimir Stoyanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
Gauges
Asked by
J
Top achievements
Rank 1
Answers by
Vladimir Stoyanov
Telerik team
Share this question
or