Format indicator value to integer

2 posts, 0 answers
  1. Johan
    Johan avatar
    5 posts
    Member since:
    Aug 2012

    Posted 23 Nov 2012 Link to this post

    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>
  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 26 Nov 2012 Link to this post

    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.
  3. DevCraft banner
Back to Top