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

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

1 Answer 106 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
kronnos_indigo
Top achievements
Rank 2
kronnos_indigo asked on 28 Jan 2010, 02:21 PM
Hi...

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 > 
          <DataTemplate> 
            <Grid Margin="3,3,3,3" Width="230"
              <Grid.ColumnDefinitions> 
                <ColumnDefinition Width="30" /> 
                <ColumnDefinition Width="110" /> 
                                <ColumnDefinition Width="90" /> 
              </Grid.ColumnDefinitions> 
              <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" /> 
            </Grid> 
          </DataTemplate> 
        </telerikInput:RadComboBox.ItemTemplate> 
      </telerikInput:RadComboBox> 
In this code, I need show when isdowndrownopen=true, the textblock "valorBase" as currency.


Juan Pablo
Bogotá-Colombia


1 Answer, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 02 Feb 2010, 10:55 AM
Hi,

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,
Konstantina
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.
Tags
ComboBox
Asked by
kronnos_indigo
Top achievements
Rank 2
Answers by
Konstantina
Telerik team
Share this question
or