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

Format indicator value to integer

1 Answer 58 Views
Gauge
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Johan
Top achievements
Rank 1
Johan asked on 23 Nov 2012, 09:53 AM
Hi!
I have created a Linear Gauge in my WP app by using the Smart Tag.
This results in some of the xaml I pasted in below.

The numeric indicator value below the linear gauge shows with a decimal, eg "12,0".
How can I format it to show without decimals, eg "12" ?
The binded value "MyIntValueInViewModel" is an int.
TIA
/Johan

<gauges:MarkerGaugeIndicator x:Name="indicator3" IsAnimated="True" gauges:LinearGaugeRange.IndicatorOffset="12"  Value="{Binding MyIntValueInViewModel}">
  <gauges:MarkerGaugeIndicator.MarkerTemplate>
    <DataTemplate>
      <Grid Height="37" Width="37">
        <Grid.RenderTransform>
          <TranslateTransform X="20"/>
          </Grid.RenderTransform>
          <TextBlock FontWeight="Bold" FontSize="13" HorizontalAlignment="Center" Text="{Binding Converter={StaticResource valueToStringConverter}}" VerticalAlignment="Center"/>
        </Grid>
      </DataTemplate>
    </gauges:MarkerGaugeIndicator.MarkerTemplate>
  </gauges:MarkerGaugeIndicator>
</gauges:LinearGaugeRange>

1 Answer, 1 is accepted

Sort by
0
Victor
Telerik team
answered on 26 Nov 2012, 12:10 PM
Hello Johan,

The text block should display whatever value is returned from the valueToStringConverter. If the converter returns an int converted to string, the text block should display it as is. It is the job of the converter to apply any formatting to the resulting string.

I hope that's helpful. Please write again if have other questions.

Kind regards,
Victor
the Telerik team
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Tags
Gauge
Asked by
Johan
Top achievements
Rank 1
Answers by
Victor
Telerik team
Share this question
or