void listView_ItemCreated(object sender, ListViewItemEventArgs e)
{
if ( listView.SelectedIndex > -1 ) return;
ListViewDataItem item = e.Item as ListViewDataItem;
if (DoSelectDataItem(item)==true)
{
listView.SelectedIndex = item.DisplayIndex;
if ( listView.SelectedItemTemplate != null )
{
e.Item.Controls.Clear();
listView.SelectedItemTemplate.InstantiateIn(e.Item);
}
}
}
bool DoSelectDataItem(ListViewDataItem item)
{
return item.DisplayIndex == 0;
}
No comments:
Post a Comment