Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6060981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:53:12+00:00 2026-05-23T08:53:12+00:00

I am trying to conditionally format the numbers that appear in a NumericAxis axis

  • 0

I am trying to conditionally format the numbers that appear in a NumericAxis axis for a LineSeries (from Silverlight 4 Toolkit). To be more specific, I want numbers that are >=10000 and <=0.0001 to display in scientific notation, but I can’t seem to make this work.

I can override the NumericAxisLabel template like this:

    <Style x:Key="NumericAxisLabelStyle" TargetType="chartingToolkit:NumericAxisLabel">
        <Setter Property="IsTabStop" Value="False"/>            
        <Setter Property="StringFormat" Value="{}{0:0.0E+00}" />                        
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="chartingToolkit:NumericAxisLabel">
                    <TextBlock Text="{TemplateBinding FormattedContent}"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

But this will apply the scientific notation format to ALL labels in the axis. What I want is for the string format expression to “kick in” only when the condition I mentioned above occurs.

I was able to accomplish this in the LineDataPoint tooltip template fairly easy by using a binding with a custom value converter, like this:

 <ControlTemplate TargetType="chartingToolkit:LineDataPoint">
      <Grid x:Name="Root" Opacity="0">
           <ToolTipService.ToolTip>
                <StackPanel Margin="2,2,2,2">
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="X:" />                                        
                        <ContentControl Content="{Binding objResultValueX, Converter={StaticResource ToCustomStringFormat}}"/>
                     </StackPanel>
                     <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Y:" />
                        <ContentControl Content="{Binding dblResultValueY, Converter={StaticResource ToCustomStringFormat}}"/>
                      </StackPanel>
                 </StackPanel>
            </ToolTipService.ToolTip>
            ...
    </Grid>
 </ControlTemplate>

If only I could specify a converter for the “FormattedContent” in the NumericAxisLabelStyle like I do for LineDataPoint template…surely there must be a way!

Any ideas?

Thanks in advance for the help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:53:13+00:00Added an answer on May 23, 2026 at 8:53 am

    Try setting the DataContext of the TextBlock to FormattedContent. Then apply the converter to the Text property as so:

    <Style x:Key="NumericAxisLabelStyle" TargetType="chartingToolkit:NumericAxisLabel"> 
        <Setter Property="IsTabStop" Value="False"/> 
        <Setter Property="Template"> 
        <Setter.Value > 
            <ControlTemplate TargetType="chartingToolkit:NumericAxisLabel"> 
                <TextBlock DataContext="{TemplateBinding FormattedContent}" Text ="{Binding Converter={StaticResource ToCustomStringFormat}}"/> 
            </ControlTemplate> 
        </Setter.Value> 
        </Setter> 
    </Style> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to extract specific fields from my file. Basically, output fields only containing
I have a cell in Excel that I want to format differently based on
I'm trying to conditionally run an exe from a batch file conditionally upon another
I'm trying to to add a post-build macro that would conditionally copy some files
I'm trying to do conditional formatting so that the cell color will change if
I'm trying to do some conditional formatting in Excel 2003, what I want to
I'm trying to use the IE specific conditional statements to alter class settings based
I am trying to manipulate a conditional string outputted from SAS into the right
I am trying to learn about all possible conditionals that can be used on
I am trying to set some public static constants on a class conditionally by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.