![]() |
Products | Support | Email a link to this topic. | Send comments on this topic. | Back to Introduction - All Topics | Help Version 19.0.4.3
|
Leadtools.Controls Assembly > Leadtools.Controls Namespace > ImageViewer Class : ItemError Event |
public event EventHandler<ImageViewerItemErrorEventArgs> ItemError
'Declaration
Public Event ItemError As EventHandler(Of ImageViewerItemErrorEventArgs)
The event handler receives an argument of type ImageViewerItemErrorEventArgs containing data related to this event. The following ImageViewerItemErrorEventArgs properties provide information specific to this event.
Property | Description |
---|---|
Data | Extra data for this error. |
Error | Get the error that was caught by the viewer. |
Item | Item that caused the error. |
Reason | Reason why the error occurred. |
RemoveEmptyItem | Indicates whether to remove the item if it did not have previous data. |
An error might occur if the image viewer is updating the image data of any of the items asynchronously or outside direct user programmatic interaction (such as during the drop part of a drag/drop operation). These operations do not occur from the user code (drop) or occur at a later time after they have been initiated (loading images asynchronously), therefore, the user must attach a handler to the ItemError event to be able to handle these errors.
When value of ImageViewerItem.Url is set to a new value, the image viewer will use the current RasterCodecsInstance to load the image data asynchronously using RasterCodecs.LoadAsync or RasterCodecs.LoadSvgAsync. This can be trigger by any of the following:
ImageViewerItems.AddFromImageUrl is called
ImageViewerItems.InsertFromImageUrl is called
ImageViewerItems.AddFromSvgUrl is called
ImageViewerItems.InsertFromSvgUrl is called
ImageViewerItems.UpdateUrl is called
ImageViewerItem.Url is set to a new value
ImageViewer.ImageUrl is set to a new value
If an error occurs, it fires the ItemError event will fire with the following values set in ImageViewerItemErrorEventArgs:
Member | Value |
---|---|
Item |
The item that triggered the error |
Reason | |
Data |
Set to the instance of CodecsLoadAsyncCompletedEventArgs used internally by the viewer during LoadAsyncCompleted or LoadSvgAsyncCompleted. |
Error |
The exception thrown |
RemoveEmptyItem |
Set to true to automatically remove this item if it did not have previous data. |
When an image or file system item is dragged and dropped over the viewer and AllowDrop was set true, the viewer will try to automatically update or add a new item and load the new image data into it. An error might occur at this point and if so, the ItemError event will fire with the following values set in ImageViewerItemErrorEventArgs:
Member | Value |
---|---|
Item |
The item that triggered the error |
Reason | |
Data |
Set to the instance of ImageViewerItemDragDropEventArgs being used. |
Error |
The exception thrown |
RemoveEmptyItem |
Set to true to automatically remove this item if it did not have previous data. |
For an example, refer to ItemChanged.