New WPF 3.5 SP1 feature: Data Formatting (with Binding.StringFormat)

Background Formatting data can be a pretty cumbersome task in WPF.  To illustrate with a very simple example, let’s say I want to display the dollar value of some item in a TextBlock: <StackPanel>   <TextBlock Text=”Choose a number:”></TextBlock>   <ComboBox Name=”myComboBox” SelectedIndex=”0″>     <ComboBoxItem>       <sys:Double>168.361</sys:Double>     </ComboBoxItem>     <ComboBoxItem>…

10