telerik listcontrol only shows part of item image

678 views Asked by At

I am filling a listcontrol (Telerik for WinForms) by using the following code :

public static List<RadListDataItem> GetItems()
        {
            List<RadListDataItem> items = new List<RadListDataItem>();


            for (int i = 1; i <= 10; i++)
            {
                RadListDataItem toadd = new RadListDataItem();
                toadd.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
                toadd.Text = "sssssssssss";
                //toadd.Image.
                string imagename = "MyProject.SuIcons.d" + i + ".JPG";
                toadd.Image = new Bitmap(Assembly.GetExecutingAssembly().
                    GetManifestResourceStream(imagename));
                items.Add(toadd);
            }
            return items;

        }

but, only top portition of every item image is show in listcontrol, I mean I cant see the whole image associated with item in the list.

Would you help me please ?

2

There are 2 answers

0
checho On BEST ANSWER

You should set the AutoSizeItems property of the control to true in order to allow the visual items size themselves according to their content:

radListControl1.AutoSizeItems = true;
1
Daniel On

You can adjust the item size of the radListView. There is a property ItemSize that you can change in the designer view. Or if you want to do it programmatically, you can do something like this.

radListView1.ItemSize = new System.Drawing.Size(200, 400);

The first parameter is the width and the second is the height.