Skybound AutoComplete

QueryImageEventArgs.ImageIndex Property

Gets or sets the 0-based index of the image in the image list.

[Visual Basic]
Public Property ImageIndex As Integer
[C#]
public int ImageIndex {get; set;}

Property Value

The 0-based index of the image in the ImageList.

Remarks

This property specifies the 0-based index of the image in the ImageList assigned to the AutoComplete control that raised the event. If you set ImageIndex to -1, no image will be displayed beside the item. This is default behavior since the default value of this property is also -1.

Example

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

See Also

QueryImageEventArgs Class | Skybound.AutoComplete Namespace