Hi Mark,
Thank you for writing.
We will introduce a new event in the upcomming service pack (later this week) which will allow you to handle this case. You will be able to cancel the selction like this:
With the current version you need to override the
ProcessSelection method in the
SimpleListViewElement class:
class
MyRadListView : RadListView
{
protected
override
RadListViewElement CreateListViewElement()
{
return
new
MyListViewElement();
}
}
class
MyListViewElement : RadListViewElement
{
protected
override
Type ThemeEffectiveType
{
get
{
return
typeof
(RadListViewElement);
}
}
protected
override
BaseListViewElement CreateViewElement()
{
if
(
this
.ViewType == ListViewType.ListView)
{
return
new
MyElement(
this
);
}
return
base
.CreateViewElement();
}
}
class
MyElement : SimpleListViewElement
{
protected
override
Type ThemeEffectiveType
{
get
{
return
typeof
(SimpleListViewElement);
}
}
public
MyElement(RadListViewElement owner) :
base
(owner)
{ }
protected
override
void
ProcessSelection(ListViewDataItem item, Keys modifierKeys,
bool
isMouseSelection)
{
if
(
this
.Items.IndexOf(item) < 10)
{
RadMessageBox.Show(
"test"
);
return
;
}
base
.ProcessSelection(item, modifierKeys, isMouseSelection);
}
}
I hope this will be useful.
Regards,
Dimitar
Telerik by Progress
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms.For more information check out this
blog post and share your thoughts.