DisplayAttribute.AutoGenerateField Property
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Gets or sets a value that indicates whether the field is automatically displayed in the user interface.
Namespace: System.ComponentModel.DataAnnotations
Assembly: System.ComponentModel.DataAnnotations (in System.ComponentModel.DataAnnotations.dll)
Syntax
'Declaration
Public Property AutoGenerateField As Boolean
public bool AutoGenerateField { get; set; }
Property Value
Type: System.Boolean
true if the field is automatically displayed in the user interface; otherwise, false.
Exceptions
Exception | Condition |
---|---|
InvalidOperationException | The property does not contain a value when trying to retrieve the value. |
Remarks
You set the AutoGenerateField property to explicitly override the default behavior of the presentation layer.
Use the GetAutoGenerateField method to retrieve the value of the AutoGenerateField property. The GetAutoGenerateField method will return nulla null reference (Nothing in Visual Basic) if the AutoGenerateField property has not been set, but the get accessor of the AutoGenerateField property will throw an exception if the property is not set.
Version Information
Silverlight
Supported in: 5, 4, 3
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
See Also