Completed
Last Updated: 31 Mar 2014 10:14 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 18 Oct 2013 06:17
Category:
Type: Bug Report
0
FIX. RadListView icon is incorrectly displayed when defining the ForeColor of the ListViewDataItem
To reproduce: -add RadListView and use the following code: public Form1() { InitializeComponent(); //add two columns to RadListView at design time this.radListView1.ViewType = Telerik.WinControls.UI.ListViewType.DetailsView; this.radListView1.AllowArbitraryItemHeight = true; this.radListView1.AllowArbitraryItemWidth = true; this.radListView1.ShowColumnHeaders = false; AddSingleTask(new FastTask("Sample Title", new DateTime(2013,03,29),"Parent Title","Owner Title",3)); AddSingleTask(new FastTask("Sample Title", new DateTime(2013,03,15),"Parent Title","Owner Title",3)); } private void AddSingleTask(FastTask task) { string[] subitems = new string[2]; string col1 = task.Title + "\nDue: "; if (task.DueDate > DateTime.MinValue) { col1 += task.DueDate.ToShortDateString(); } subitems[0] = col1; subitems[1] = "Location: " + task.ParentTitle + "\nOwner: " + task.Owner; ListViewDataItem item = new ListViewDataItem(task.Title, subitems); item.Image = Properties.Resources.check; item.Tag = task; item.ForeColor = Color.DarkRed; this.radListView1.Items.Add(item); } public class FastTask { public string Title { get; set; } public DateTime DueDate { get; set; } public string ParentTitle { get; set; } public string Owner { get; set; } public int ClosedById { get; set; } public FastTask(string title, DateTime dueDate, string parentTitle, string owner, int closedById) { this.Title = title; this.DueDate = dueDate; this.ParentTitle = parentTitle; this.Owner = owner; this.ClosedById = closedById; } } 

Workaround: subscribe to VisualItemFormatting event and customize DetailListViewDataCellElement as follows: this.radListView1.VisualItemFormatting += radListView1_VisualItemFormatting; private void radListView1_VisualItemFormatting(object sender, ListViewVisualItemEventArgs e) { if (e.VisualItem is DetailListViewVisualItem) { DetailListViewVisualItem item = e.VisualItem as DetailListViewVisualItem; if (item.CellsContainer.Children.Count > 0) { ((DetailListViewDataCellElement)item.CellsContainer.Children[0]).TextImageRelation = TextImageRelation.ImageBeforeText; ((DetailListViewDataCellElement)item.CellsContainer.Children[0]).ImageAlignment = ContentAlignment.MiddleLeft; } } }
0 comments