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;
}