NumericIndicator - Show Characters

5 posts, 0 answers
  1. Daniel Ruehle
    Daniel Ruehle avatar
    19 posts
    Member since:
    May 2010

    Posted 24 Jun 2010 Link to this post

    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


  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 24 Jun 2010 Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
  4. Daniel Ruehle
    Daniel Ruehle avatar
    19 posts
    Member since:
    May 2010

    Posted 25 Jun 2010 Link to this post

    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
  5. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 25 Jun 2010 Link to this post

    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
  6. Daniel Ruehle
    Daniel Ruehle avatar
    19 posts
    Member since:
    May 2010

    Posted 28 Jun 2010 Link to this post

    OK, I got it.

    Thanks for your reply.

    BR,
    Daniel
Back to Top
UI for WPF is Visual Studio 2017 Ready