Completed
Last Updated: 09 Apr 2019 14:17 by Dimitar
Release R2 2019 (LIB 2019.1.415)
Vishal
Created on: 04 Mar 2019 09:07
Category: UI for WinForms
Type: Bug Report
1
RadListControl: Extend the CreatingVisualListItemEventArgs so that they have information about the data item
Currently, the event arguments do not expose the data item.
2 comments
Dimitar
Posted on: 09 Apr 2019 14:17
Hello, 
 
A Fix will be available in LIB Version 2019.1.415 scheduled for April 15th.

Regards,
Dimitar
ADMIN
Hristo
Posted on: 04 Mar 2019 09:16
Hi,

Workaround: use a custom element provider

public class MyListElementProvider : ListElementProvider
{
    private RadListElement listElement;
  
    public MyListElementProvider(RadListElement listElement)
        : base(listElement)
    {
        this.listElement = listElement;
    }
  
    public event CreatingVisualListItemEventHandler MyCreatingVisualItem;
  
    public override IVirtualizedElement<RadListDataItem> CreateElement(RadListDataItem data, object context)
    {
        RadListVisualItem result = new RadListVisualItem() { Tag = data };
  
        result = this.OnMyCreatingVisualListItem(result);
  
        if (result == null)
        {
            if (string.IsNullOrEmpty(this.listElement.DescriptionTextMember))
            {
                result = new RadListVisualItem();
            }
            else
            {
                result = new DescriptionTextListVisualItem();
            }
        }
  
        return result;
    }
  
    protected internal virtual RadListVisualItem OnMyCreatingVisualListItem(RadListVisualItem item)
    {
        if (this.MyCreatingVisualItem != null)
        {
            CreatingVisualListItemEventArgs args = new CreatingVisualListItemEventArgs();
            args.VisualItem = item;
            this.MyCreatingVisualItem(this, args);
            return args.VisualItem;
        }
  
        return null;
    }
}
 
public RadForm1()
{
    InitializeComponent();
  
    MyListElementProvider provider = new MyListElementProvider(this.radPivotFieldList1.RowLabelsControl.ListElement);
    provider.MyCreatingVisualItem += this.Provider_MyCreatingVisualItem;
    this.radPivotFieldList1.RowLabelsControl.ListElement.ViewElement.ElementProvider = provider;
}


Regards,
Hristo
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.