Occurs when an image is chosen from an ImageList to be displayed beside an item in the drop-down suggestion window.
The event handler receives an argument of type QueryImageEventArgs containing data related to this event. The following QueryImageEventArgs properties provide information specific to this event.
| Property | Description |
|---|---|
| AutoComplete | Gets the instance of AutoComplete that raised the event. |
| ImageIndex | Gets or sets the 0-based index of the image in the image list. |
| ItemIndex | Gets the index of the item for which the event was raised. |
| ItemValue | Gets the item object for which the event was raised. |
| Text | Gets the string representation of the item, as it is displayed in the drop-down suggestion window. |
| VisibleIndex | Gets the index of the visible item for which the event was raised. |
This example chooses one of two images, depending on whether a user is online. For this example, we need to assume a few things: an array of UserInfo objects is being used as the data source for autocompletion, and that an ImageList with two images has been created and assigned to the control.
[C#]
private void autoComplete1_QueryImage(object sender,
Skybound.AutoComplete.QueryImageEventArgs e)
{
// determine whether the user is online
if ((e.ItemValue as UserInfo).IsOnline)
e.ImageIndex = 0; // the first image in the list is used for online users
else
e.ImageIndex = 1; // the second image is used for offline users
}
[Visual Basic]
Private Sub autoComplete1_QueryImage(ByVal sender As Object, _
ByVal e As Skybound.AutoComplete.QueryImageEventArgs)
' determine whether the user is online
If CType(e.ItemValue,UserInfo).IsOnline Then
' the first image in the ImageList is used for online users
e.ImageIndex = 0
Else
' the second image is used for offline users
e.ImageIndex = 1
End If
End Sub
AutoCompleteManager Class | Skybound.AutoComplete Namespace