Leadtools.Controls Namespace > ImageViewer Object : ItemChanged Event |
add_itemChanged(function(sender, e)) itemChanged.add(function(sender, e)) remove_itemChanged(function(sender, e)) itemChanged.remove(function(sender, e))
This event occurs when any of the items inside this ImageViewer changes. The ImageViewerItemChangedEventArgs will contain the item that has been changed in ImageViewerItemChangedEventArgs.Item and the reason for the change in ImageViewerItemChangedEventArgs.Reason.
Change the value of the following properties or calling the methods programatically or by the viewer will raise the ItemChanged event with the specified reason:
Property or Method | Value of ImageViewerItemChangedEventArgs.Reason |
---|---|
Image |
ImageViewerItemChangedReason.Image (and optionally ImageViewerItemChangedReason.Resolution if the value of Resolution is also set. |
Canvas |
ImageViewerItemChangedReason.Image (and optionally ImageViewerItemChangedReason.Resolution if the value of Resolution is also set. |
Url |
ImageViewerItemChangedReason.Image (and optionally ImageViewerItemChangedReason.Resolution if the value of Resolution is also set. |
ImageSize | |
Size | |
Resolution | |
Floater | |
FloaterTransform | |
FloaterOpacity | |
Text | |
IsSelected | |
IsHovered | |
IsEnabled | |
IsVisible | |
Transform | |
Zoom | |
ResizeOnTransform | |
ClipImageToContent | |
ImageHorizontalAlignment | |
ImageVerticalAlignment | |
TextHorizontalAlignment | |
TextHorizontalAlignment |
The viewer automatically listens to these events internally and will perform the necessary action, for example, if any property that affect the transformation changes, UpdateTransform will be called. If the property change requires rendering only, then the item will be invalidated.
This example will track the ItemChanged and ItemError event and show information on them.
Run the demo, click the Example button.
Start with the ImageViewer example, remove all the code inside the example function (search for the "// TODO: add example code here" comment) and insert the following code:
this._imageViewer.itemChanged.add(function (sender, e) { var item = e.item; var sb = "ItemChanged: " + this._imageViewer.items.indexOf(item).toString() + " Reason:" + e.reason.toString() + " Size:" + item.size.toString() + " Res:" + item.resolution.toString(); if (item.image != null) sb += " Image: " + item.image.width.toString() + " by " + item.image.height.toString(); else sb += " Image: null"; alert(sb); if (item.url != null) alert(" Url:" + item.url.toString()); });
Parameter | Type | Description |
---|---|---|
sender | 'var' | The source of the event. |
e | ImageViewerItemChangedEventArgs | The event data. |