code_junkie

Currency formatting on ComboBox items

Nov 12th, 2011
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. <Window.Resources>
  2. <my:CurrencyConverter x:Key="currencyConverter" />
  3.  
  4. <DataTemplate x:Key="thingTemplate" DataType="{x:Type my:Thing}">
  5. <TextBlock
  6. Text="{Binding Amount,Converter={StaticResource currencyConverter}}" />
  7. </DataTemplate>
  8. </Window.Resources>
  9.  
  10. <ComboBox
  11. ItemSource="... some list of Thing instances ..."
  12. ItemTemplate="{StaticResource thingTemplate}" />
  13.  
  14. <ComboBox ItemStringFormat="c">
  15.  
  16. <TextBox Text="{Binding Path=Value, StringFormat=Amount: {0:C}}"/>
Add Comment
Please, Sign In to add comment