DisplayFormatAttribute Class
Specifies how data fields are displayed and formatted.
Namespace: System.ComponentModel.DataAnnotations
Assembly: System.ComponentModel.DataAnnotations (in System.ComponentModel.DataAnnotations.dll)
The DisplayFormatAttribute type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | DisplayFormatAttribute | Initializes a new instance of the DisplayFormatAttribute class. |
| Name | Description | |
|---|---|---|
![]() | ApplyFormatInEditMode | Gets or sets a value that indicates whether the formatting string that is specified in the DataFormatString property is applied to the member when in edit mode. |
![]() | ConvertEmptyStringToNull | Gets or sets a value that indicates whether empty string values ("") are automatically converted to null. |
![]() | DataFormatString | Gets or sets the string value that specifies how to display values for the member. |
![]() | NullDisplayText | Gets or sets the text to display for a member when the value of the member is null. |
| Name | Description | |
|---|---|---|
![]() | Equals | Infrastructure. Returns a value that indicates whether this instance is equal to a specified object. (Inherited from Attribute.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetHashCode | Returns the hash code for this instance. (Inherited from Attribute.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | Match | When overridden in a derived class, returns a value that indicates whether this instance equals a specified object. (Inherited from Attribute.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
You apply the DisplayFormatAttribute attribute to a property to specify how those property values are rendered in the user interface. You set the DataFormatString property to provide a formatting string that is appropriate for the type of data in the property. For example, if the property contains values that you want to display as scientific notation, you can set the DataFormatString property to {0:E}.
You use the ConvertEmptyStringToNull and NullDisplayText properties to specify how null and empty string ("") are rendered. You use the ApplyFormatInEditMode property to specify whether the values in the attribute are applied when the user is editing the data.
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
