Text inside State Indicator

4 posts, 0 answers
  1. Tim
    Tim avatar
    85 posts
    Member since:
    Aug 2008

    Posted 24 Jun 2010 Link to this post

    I have the following markup but I cannot seem to be able to get the Template correct for displaying the current value of my "averageIndicator" inside the "stateIndicator".  I would like the state indicator to stay the same (the circular-looking shape) but just have some text inside of it.  Is this possible?

    <telerikGauges:IndicatorList x:Name="indicators"
        <telerikGauges:Marker x:Name="averageIndicator"  
            Style="{StaticResource LinearMarkerStyle}" 
            Duration="00:00:02" 
            IsAnimated="True" 
            Opacity="0.8" 
            TooltipFormat="{0:0.##}" 
            Value="80" 
            /> 
        <telerikGauges:StateIndicator x:Name="stateIndicator" 
            Left="0.15" 
            Top="0.07" 
            Opacity="0.6" 
            RelativeWidth="0.1" 
            RelativeHeight="0.1" 
            Value="{Binding ElementName=averageIndicator, Path=Value}"
        </telerikGauges:StateIndicator> 
    </telerikGauges:IndicatorList> 

  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 24 Jun 2010 Link to this post

    Hi Tim,

    The StateIndicator is not designed to show any text inside, but just a color which corresponds to the given value. Still, you can put a simple TextBlock over the scale and show text there.

    All the best,
    Andrey Murzov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Tim
    Tim avatar
    85 posts
    Member since:
    Aug 2008

    Posted 24 Jun 2010 Link to this post

    Just to clarify, when you say "over the scale" do you mean above the gauge completely or inside the gauge but overlaying the scale?  Just wondering if you have an example.
  5. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 25 Jun 2010 Link to this post

    Hello Tim,

    The example code with the TextBlock is the following:
    <Grid Width="100" Height="300">
        <telerikGauge:RadGauge>
            <telerikGauges:LinearGauge>
                <telerikGauges:LinearScale>
                    <telerikGauges:IndicatorList x:Name="indicators">
                        <telerikGauges:Marker x:Name="averageIndicator"
                                              Duration="00:00:02"
                                              IsAnimated="True"
                                              Opacity="0.8"
                                              TooltipFormat="{}{0:0.##}"
                                              Value="80"
                                              />
                        <telerikGauges:StateIndicator x:Name="stateIndicator"
                                                      Left="0.15"
                                                      Top="0.07"
                                                      Opacity="0.6"
                                                      RelativeWidth="0.1"
                                                      RelativeHeight="0.1"
                                                      Value="{Binding ElementName=averageIndicator, Path=Value}">
                        </telerikGauges:StateIndicator>
                    </telerikGauges:IndicatorList>
                </telerikGauges:LinearScale>
            </telerikGauges:LinearGauge>
        </telerikGauge:RadGauge>
      
        <TextBlock
            FontWeight="Bold"
            Margin="21,28,29,252"
            Width="50" Height="20">
            <TextBlock.Text>
                <Binding
                    ElementName="averageIndicator"
                    Path="Value"
                    StringFormat="{}{0:F0}"/>
            </TextBlock.Text>
        </TextBlock>
    </Grid>

    Kind regards,
    Andrey Murzov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top