Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Expand]Controls and Libraries
 [Collapse]Common Features
  [Expand]Data Binding Common Concepts
  [Expand]Data Source Wizard
  [Expand]Expressions
  [Expand]Behaviors
  [Expand]Application Appearance
  [Expand]Filtering UI Context
  [Expand]High DPI Support
  [Expand]Scaffolding Wizard
  [Collapse]Formatting Values
    How to: Format Date-Time Values Using the LongDate Pattern
    How to: Format Date-Time Values Using a Custom Format Pattern
    How to: Format a Numeric Value according to its Sign
    How to: Add Custom Text to a Formatted String
    How to: Create a Custom Formatter to Change the Case of String Values
    How to: Create a Custom Formatter to Represent Decimal Values in Binary
    Formatting Approaches
    Members that Support the Formatting Mechanism
    Format Specifiers
    Composite Formatting
    Custom Formatting
   HTML Text Formatting
  [Expand]Menus
  [Expand]Tooltip Management
  [Expand]Saving and Restoring Layouts
   Clipboard - Copy Data and Formatting
   Version Compatibility: Default Property Values
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Formatting Approaches

The formatting mechanism allows you to format values using one of the following approaches:

  • Using the standard or custom format specifiers.

    These let you format numeric and date-time values according to predefined or custom patterns (they are all described in MSDN and can also be found in the Format Specifiers topic). For instance, a numeric value can be represented as a currency amount or a hexadecimal value, using scientific notation, etc. A date/time value can be represented in the standard Short Date. Long Date or Full Date/Time form.

    Custom format specifiers can be used to construct a new custom pattern if the standard patterns do not suit your needs. Custom text can be added to the resultant string when using custom format specifiers.

  • Using composite formatting.

    This feature extends the previous one, as it allows you to format numeric and date/time values using one of the standard or custom format specifiers, and adds any custom text to the resultant string. When formatting string values, it is also possible to add custom text to the resultant string.

    See the Composite Formatting topic for details.

  • Using a custom formatter.

    This gives you the ability to format values of any type, though you will need to format values manually via code. See the Custom Formatting topic for more details.

How would you rate this topic?​​​​​​​