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

NumericIndicator - Show Characters

4 Answers 84 Views
Gauges
This is a migrated thread and some comments may be shown as answers.
Daniel Ruehle
Top achievements
Rank 1
Daniel Ruehle asked on 24 Jun 2010, 11:50 AM
Hello telerikTeam,

is it possible to show Character in numericIndicator / Numberposition e.g FM 99,4 kHZ If yes how can I achieve it ?

Thank you

Daniel


4 Answers, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 24 Jun 2010, 04:38 PM
Hi Daniel Ruehle,

Yes, it is possible to show not-numeric characters in the numeric indicator. To do it you should specify data templates for necessary characters in your application. The data template must have strong formatted key. For numeric positions which show numbers using fonts it must be “FontFamily[Char]”, where [Char] is a character which will be represented (“FontFamilyF” for ‘F’ char, for example). Then you can use necessary characters in the NumericIndicator Format property. The XAML below show the FM 99.4 kHZ in the numeric indicator:

<Window x:Class="Telerik.RadGauge.WPF.Q1.MainWindow"
        Title="MainWindow" Height="350" Width="600">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Telerik.Windows.Controls.Gauge;component/Themes/generic.xaml" />
            </ResourceDictionary.MergedDictionaries>
  
            <Style x:Key="FontFamilyFill" TargetType="TextBlock">
                <Setter Property="VerticalAlignment" Value="Center"/>
                <Setter Property="HorizontalAlignment" Value="Center"/>
            </Style>
  
            <DataTemplate x:Key="FontFamilyF">
                <Grid>
                    <TextBlock Style="{StaticResource FontFamilyFill}" Text="F"/>
                </Grid>
            </DataTemplate>
  
            <DataTemplate x:Key="FontFamilyM">
                <Grid>
                    <TextBlock Style="{StaticResource FontFamilyFill}" Text="M"/>
                </Grid>
            </DataTemplate>
  
            <DataTemplate x:Key="FontFamilyH">
                <Grid>
                    <TextBlock Style="{StaticResource FontFamilyFill}" Text="H"/>
                </Grid>
            </DataTemplate>
  
            <DataTemplate x:Key="FontFamilyk">
                <Grid>
                    <TextBlock Style="{StaticResource FontFamilyFill}" Text="k"/>
                </Grid>
            </DataTemplate>
  
            <DataTemplate x:Key="FontFamilyZ">
                <Grid>
                    <TextBlock Style="{StaticResource FontFamilyFill}" Text="Z"/>
                </Grid>
            </DataTemplate>
        </ResourceDictionary>
    </Window.Resources>
    <Grid>
          
        <telerik:RadGauge Width="200" Height="200">
            <telerik:NumericScale>
                <telerik:NumericIndicator x:Name="numericIndicator"
                                      Format="FM {0:F1} kHZ"
                                      FontFamily="Arial"
                                      Left="0.1" 
                                      Top="0.8"
                                      RelativeWidth="0.8"
                                      RelativeHeight="0.16"
                                      Background="Transparent"
                                      BorderThickness="0"
                                      FontSize="16"
                                      Value="99.4">
                    <telerik:NumberPosition />
                    <telerik:NumberPosition />
                    <telerik:NumberPosition />
                    <telerik:NumberPosition />
                    <telerik:NumberPosition />
                    <telerik:NumberPosition />
                    <telerik:NumberPosition />
                    <telerik:NumberPosition />
                    <telerik:NumberPosition />
                    <telerik:NumberPosition />
                    <telerik:NumberPosition />
                    <telerik:NumberPosition />
                    <telerik:NumberPosition />
                </telerik:NumericIndicator>
            </telerik:NumericScale>
        </telerik:RadGauge>
    </Grid>
</Window>


Best wishes,
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
0
Daniel Ruehle
Top achievements
Rank 1
answered on 25 Jun 2010, 07:51 AM
Hi Andrey,

Thank you very much for the example, but it will mean that I can not assign a value of characters dynamically, right?
What I try to do, is a display panel that is showing different message like a display panel for example at the airport or like at main station.


Thank you

Daniel
0
Andrey
Telerik team
answered on 25 Jun 2010, 11:53 AM
Hello Daniel Ruehle,

Actually NumericIndicator is designed for different purposes, but you can do it. You have to specify data templates for all possible characters, and then you can simple change Format property in the code:

numericIndicator.Format = "Sofia, arrival at 10:30";


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
0
Daniel Ruehle
Top achievements
Rank 1
answered on 28 Jun 2010, 06:54 PM
OK, I got it.

Thanks for your reply.

BR,
Daniel
Tags
Gauges
Asked by
Daniel Ruehle
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Daniel Ruehle
Top achievements
Rank 1
Share this question
or