Properties
inherited fromIDataObject
Value:
true if the data object contains html; otherwise, false.ContainsImage
Gets a value indicating whether this IDataObject contains a value for IDataObject.Image.
Value:
true if the data object contains an image; otherwise, false.inherited fromIDataObject
Value:
true if the data object contains text; otherwise, false.inherited fromIDataObject
Remarks: This can be a mix of both URL and File objects. You can use Uri.IsFile to test for that. On some platforms, (e.g. windows), only a single URL can be retrieved or set.
Value:
true if the data object contains uris; otherwise, false.Value: The html value in the data object, or null if no html in the data object.
Remarks: Some platforms may use this to identify controls (e.g. web)
Value: The image in the data object, or null if no image is in the data object.
NativeHandle
nint NativeHandle { get; }
Gets the native platform-specific handle for integration purposes
Value: The native handle.
Value: The plain text in the data object, or null if no plain text string in the data object.
Value: The content types in the data object.
Remarks: This can be a mix of both URL and File objects. You can use Uri.IsFile to test for that. On some platforms, (e.g. windows), only a single URL can be retrieved or set.
Value: The uris of the files, or null if no files are in the data object.
Methods
Clear
void Clear()
Clears the data object completely of all values
Contains
Gets a value indicating that data with the specified type is contained in the data object.
Parameters:
| type (string) | Type to test. |
Returns:
true if the data object contains the specified type, false otherwise.GetData
Gets a data array from the data object with the specified type identifier.
Parameters:
| type (string) | Type identifier that was used to store the data. |
Returns: The data array, or null if not found in the data object.
See Also: IDataObject.SetData(byte[], string)
GetObject
Gets an object from the data object with the specified type
Remarks: This is useful when you know the type of object, and it is serializable or has a type converter to convert from string. If it cannot be converted it will return the default value.
Parameters:
| type (string) | Type identifier to get from the data object |
| objectType (Type) | Type of the object to get, or null to detect type |
Returns: An instance of the object to recieve, or the default value.
Remarks: This is useful when you know the type of object, and it is serializable or has a type converter to convert from string. If it cannot be converted it will return the default value.
Parameters:
| type (string) | Type identifier to get from the data object |
Returns: An instance of the object to recieve, or the default value.
GetString
Gets a string from the data object with the specified type identifier.
Parameters:
| type (string) | Type identifier that was used to store the data. |
Returns: The string.
See Also: IDataObject.SetString(string, string)
Remarks: Most events are late bound by this method. Instead of wiring all events, this will be called with an event string that is defined by the control. This is called automatically when attaching to events, but must be called manually when users of the control only override the event's On... method.
Initialize
void Initialize()
Called after the widget is constructed
Remarks: This gets called automatically after the control is constructed and the Widget.IHandler.Widget and Widget.Platform properties are set. When the handler has specialized construction methods, then the AutoInitializeAttribute can be used to disable automatic initialization. In this case, it is the responsibility of the subclass to call Widget.Initialize()
SetData
sets a data array into the data object with the specified type identifier.
SetObject
Sets the
value into the data object with the specified type using serialization or type converterSetString
Sets a string into the data object with the specified type identifier.
Remarks: This is useful when setting alternate string values into the data object that are not plain text. If you are storing plain text, use the IDataObject.Text property instead.
Parameters:
| value (string) | Value to set in the data object. |
| type (string) | Type identifier that was used to store the data. |
See Also: IDataObject.GetString(string)
TryGetObject
#Attempts to get the specified value from the clipboard in a native-supplied way
TrySetObject
#Attempts to set the specified object to the clipboard in a native-supplied way
Remarks: This is used so native handlers can set certain objects in a particular way. For example, on macOS, setting a Color object for DataFormats.Color will use native API to set the value.
Returns: true if the native handler set the value, or false to fallback to serialization or conversion to string
UnhandleEvent
Called when the last subscriber to an event has been removed, so the platform can stop listening for it.
Remarks: Only reached for events whose remove accessor uses PropertyStore.RemoveHandlerEvent(string, Delegate), and only for events that were attached because something subscribed to them. An event attached because the widget overrides its On[Event] method is never detached, since it has to keep firing regardless. Most events stay attached for the life of the widget, which costs nothing. Detaching is worth wiring up for the few that hold onto something expensive or process wide while they are attached, such as a system wide hook. Handlers deriving from WidgetHandler<TWidget> get an implementation of this that dispatches to WidgetHandler<TWidget>.DetachEvent(string), which is what to override.
Parameters:
| id (string) | ID of the event to stop handling |