Completed
Last Updated: 15 Oct 2014 14:14 by ADMIN
ADMIN
Dess | Tech Support Engineer, Sr.
Created on: 08 Aug 2014 11:40
Category:
Type: Bug Report
3
FIX. RadListView - Images are not displayed in DetailsView although the ImageKey property is set
To reproduce: add a RadListView, an ImageList (with two images: e.g. "crop.png" and "save.png") and a RadDropDownList. Use the following code snippet:

public Form1()
{
    InitializeComponent();

    this.radDropDownList1.DataSource = Enum.GetValues(typeof(ListViewType));

    this.radListView1.ImageList = this.imageList1;
    this.radListView1.SmallImageList = this.imageList1;

    this.radListView1.Columns.Add("Column1");
    string imageKey = string.Empty;
    for (int i = 0; i < 5; i++)
    {
        this.radListView1.Items.Add("Item" + i);
        if (i % 2 == 0)
        {
            imageKey = "crop.png";
        }
        else
        {
            imageKey = "save.png";
        }
        this.radListView1.Items.Last().ImageKey = imageKey;
        this.radListView1.Items.Last()["Column1"] = this.radListView1.Items.Last().Text;
    }
}

private void radDropDownList1_SelectedValueChanged(object sender, EventArgs e)
{
    if (this.radDropDownList1.SelectedValue != null)
    {
        this.radListView1.ViewType = (ListViewType)this.radDropDownList1.SelectedValue;
    }
}

Initially, we will see the image displayed for each item. However, when you change to DetailsView, the image is not displayed.

Workaround:  use the RadListView.CellFormatting event and set CellElement.Image property for the cells in the first column.
0 comments