Occurs when the ObjectFormatter.Format method is called. Allows you to perform the custom processing of the string passed to the Format method.
The CustomFormatObject event's data class is CustomFormatObjectEventArgs. The following properties provide information specific to this event:
|EmptyEntriesMode||Returns the EmptyEntriesMode enumeration value that defines the processing behavior.|
|FormatString||Returns the format string that is being processed.|
|Handled||Gets or sets a value that indicates whether the event handler has completely handled the event or whether the system should continue its own processing. Inherited from HandledEventArgs.|
|Object||Returns the object whose property values must replace the format items in the format string.|
|Result||Returns the resulting string that must be returned by the ObjectFormatter.Format method.|
The Format method replaces format items in a string with the property values of an object. If its formatting behavior does not suit you, handle this event. The string to be formatted is passed as the event handler's CustomFormatObjectEventArgs.FormatString parameter. The object to be used to replace format items is passed as the event handler's CustomFormatObjectEventArgs.Object parameter. After you have processed the string, pass the result to the handler's CustomFormatObjectEventArgs.Result parameter. Set the handler's CustomFormatObjectEventArgs.Handled parameter to true, to indicate that you have completely processed the passed string. Otherwise, the changes you have made will be discarded and the Format method will perform the default processing of the string.