This is a migrated thread and some comments may be shown as answers.

RadListBox with images

3 Answers 96 Views
ComboBox and ListBox (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Warren
Top achievements
Rank 1
Warren asked on 28 Aug 2008, 04:13 PM
How do I add images to a radlistbox?

This is what I have so far:

    Me.RadListBox1.DisplayMember = "LocationStatus" 
    Me.RadListBox1.ValueMember = "LocationStatusId" 
    Me.RadListBox1.ImageList = Me.ImageList1 



3 Answers, 1 is accepted

Sort by
0
Angel
Telerik team
answered on 29 Aug 2008, 04:18 PM
Hello Warren,

You have to set either the ImageIndex or ImageKey property for each item in the listbox. This is done through the property grid.

Let us know if you had something different in mind.

 
Sincerely yours,
Angel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Warren
Top achievements
Rank 1
answered on 29 Aug 2008, 04:35 PM
I'm setting my datasource during runtime

Me.RadListBox1.DataSource = OTS.GetLocationStatus(True)


How do I set the ImageIndex or ImageKey in code?
0
Angel
Telerik team
answered on 01 Sep 2008, 04:17 PM
Hi Warren,

Here is a sample code that sets the first image from the image list to every even item, while the second image is set to the odd items:

Dim i As Integer = 0 
Do While i < Me.RadListBox1.Items.Count 
    Dim item As RadListBoxItem = CType(Me.RadListBox1.Items(i), RadListBoxItem)  
    If (i Mod 2) = 0 Then  
        item.ImageIndex = 0 
    Else  
        item.ImageIndex = 1 
    End If  
    i += 1  
Loop 

You may also consider the TextImageRelation, TextAlignment and ImageAlignment properties of RadListBoxItem.

 
Greetings,
Angel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ComboBox and ListBox (obsolete as of Q2 2010)
Asked by
Warren
Top achievements
Rank 1
Answers by
Angel
Telerik team
Warren
Top achievements
Rank 1
Share this question
or