Drag/Drop action data.
Constructors
DataObject
#public DataObject(IHandler handler)
Initializes a new instance of the DataObject class.
Parameters:
| handler (DataObject.IHandler) | Handler implementation. |
Properties
ContainsHtml
#Gets a value indicating whether this DataObject contains a value for Html.
Value:
true if the data object contains html; otherwise, false.Implements: ContainsHtml
ContainsImage
#Gets a value indicating whether this DataObject contains a value for Image.
Value:
true if the data object contains an image; otherwise, false.Implements: ContainsImage
ContainsText
#Gets a value indicating whether this DataObject contains a value for Text.
Value:
true if the data object contains text; otherwise, false.Implements: ContainsText
ContainsUris
#Gets a value indicating whether this DataObject contains a value for Uris.
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.Implements: ContainsUris
Remarks: This can sometimes be useful to get the platform-specific object. Some handlers may not have any backing object for its functionality, so this may be null. It is more preferred to use the Widget.Handler and cast that to the platform-specific handler class which can give you additional methods and helpers to do common tasks. For example, the Application object's handler for OS X has a AddFullScreenMenuItem property to specify if you want full screen support in your app.
Html
#Gets or sets html text in the data object.
Value: The html value in the data object, or null if the data object contains no html.
Implements: Html
Image
#Gets or sets an image in the data object.
Value: The image in the data object, or null if the data object contains no image.
Implements: Image
IsDisposed
Gets or sets a value indicating whether this Widget has been disposed.
Remarks: When the widget is disposed, it can no longer be used.
Value:
true if this instance has been disposed; otherwise, false.NativeHandle
public nint NativeHandle { get; }
Gets the native platform-specific handle for integration purposes
Value: The native handle.
inherited fromWidget
Remarks: This gets set to the current Platform.Instance during the construction of the object
Remarks: Styles allow you to attach custom platform-specific logic to a widget. In your platform-specific assembly, use Add{H} to add the style logic with the same id.
Example:
// in your UI
var control = new Button { Style = "mystyle" };
// in your platform assembly
using Eto.Mac.Forms.Controls;
Styles.AddHandler<ButtonHandler>("mystyle", handler => {
// this is where you can use handler.Control to set properties, handle events, etc.
handler.Control.BezelStyle = NSBezelStyle.SmallSquare;
});Text
#Gets or sets the plain text in the data object.
Value: The plain text in the data object, or null if the data object contains no text.
Implements: Text
Types
#Gets the types of data in the data object to be used with GetString(string) and GetData(string)
Value: The types.
Implements: Types
Methods
Contains
#Gets a value indicating that data with the specified type is contained in the data object.
Dispose
public void Dispose()
Disposes of this widget, supressing the finalizer
Parameters:
| disposing (bool) | True if the caller called Widget.Dispose() manually, false if being called from a finalizer |
GetCallback
Gets an instance of an object used to perform callbacks to the widget from handler implementations
Remarks: The callback should implement the parent class' Widget.ICallback interface so that there only needs to be a single callback for the entire hierarchy. This should return a static instance to avoid having overhead for each instance of your control.
Returns: The callback instance to use for this widget
GetData
#Gets a byte array from the data object with the specified type identifier.
GetDataStream
#Gets the data stream with the specified type identifier.
Parameters:
| type (string) | Type identifier that was used to store the data. |
Returns: The data stream if found, or null otherwise.
See Also: SetDataStream(Stream, 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.
Implements: GetObject
GetObject
#Gets a serialized value with the specified
type identifier.GetObject<T>
#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 |
Returns: An instance of the object to recieve, or the default value.
Implements: GetObject
GetString
#Gets a string from the data object with the specified type identifier.
Initialize
protected void Initialize()
Initializes the widget handler
Remarks: This is typically called from the constructor after all of the logic is completed to construct the object. If your handler interface has the AutoInitializeAttribute set to false, then you are responsible for calling this method in your constructor after calling the creation method on your custom handler.
inherited fromWidget
SetDataStream
#Sets a data stream into the clipboard with the specified type identifier.
SetObject
#Sets the
value into the data object with the specified type using serialization or type converterToString
Gets a string that represents the current object with its ID if specified.
Returns: A string value indicating the type and ID (if specified) of this widget.
Overrides: Object.ToString
Events
inherited fromWidget