How I do for formatting text in a textblock of item template?

2 posts, 0 answers
  1. kronnos_indigo
    kronnos_indigo avatar
    61 posts
    Member since:
    Jul 2006

    Posted 28 Jan 2010 Link to this post


    If I  have items template in my combobox. How I do for formatting text, for example currenci?

    <telerikInput:RadComboBox x:Name="rcbContratoItems" Margin="170,1,0,0" Width="100" MaxDropDownHeight="250" FontFamily="Trebuchet MS" FontSize="10.667"  
                              Background="#FFD6E9F2" IsHighlighted="True" IsReadOnly="True" TabIndex="1"
            <telerikInput:RadComboBox.ItemTemplate > 
                <Grid Margin="3,3,3,3" Width="230"
                    <ColumnDefinition Width="30" /> 
                    <ColumnDefinition Width="110" /> 
                                    <ColumnDefinition Width="90" /> 
                  <TextBlock Grid.Column="0" Foreground="Black" FontFamily="Verdana" FontSize="8" Text="{Binding Item}" HorizontalAlignment="Right" Margin="0,0,10,0"/> 
                  <TextBlock Grid.Column="1" Foreground="Black" FontFamily="Verdana" FontSize="8" Text="{Binding nombreAuxiliar}" HorizontalAlignment="Left"/> 
                                <TextBlock Grid.Column="2" Foreground="Black" FontFamily="Verdana" FontSize="8" Text="{Binding ValorBase}" HorizontalAlignment="Right" /> 
    In this code, I need show when isdowndrownopen=true, the textblock "valorBase" as currency.

    Juan Pablo

  2. Konstantina
    Konstantina avatar
    2332 posts

    Posted 02 Feb 2010 Link to this post


    Thank you for the question.

    To achieve your goal you can create a formatting value converter for the TextBlock. You can see an example here. Then you can bind it like:
    <TextBlock Text="{Binding ValorBase, Converter={StaticResource formatConverter}, ConverterParameter='Valor Base: {0}'}"/>

    Hope that helps.

    If you have further questions please feel free to ask again.

    Best wishes,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top