String Format Extension in XAML Binding in Silverlight 4


In Silverlight 4, an extension property called StringFormat is added to display formatting display. There are some predefined formats available. In this article we will see some of them.

image

Date Formatting: pre-defined like above: StringFormat=\{0:d\}, custom: StringFormat=‘MM-dd-yyyy’

Currency Formatting: String.Format=\{0:c\} or just String.Format=C

Percent Formatting: String.Format=\{0:p\} or String.Format=P or single decimal point String.Format=0.0%

Number Formatting:

image

pre-defined like above: StringFormat=\{0:N\}, or custom: StringFormat=0\,000.0

for more via String Format Extension in XAML Binding in Silverlight 4

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s