3 Answers, 1 is accepted
0
Hi Rhea,
Thank you for your question.
To select an item programmatically, you can set the SelectedItem property of RadListView. Alternatively, you can use the Select(ListViewDataItem[] items) method:
I hope this will help you. Feel free to write back if you have any further questions.
All the best,
Ivan Todorov
the Telerik team
Thank you for your question.
To select an item programmatically, you can set the SelectedItem property of RadListView. Alternatively, you can use the Select(ListViewDataItem[] items) method:
//to select a single item:
this
.radListView1.SelectedItem =
this
.radListView1.Items[0];
//to select multiple items when multiselect is enabled:
this
.radListView1.Select(
new
ListViewDataItem[] {
this
.radListView1.Items[0],
this
.radListView1.Items[1] });
I hope this will help you. Feel free to write back if you have any further questions.
All the best,
Ivan Todorov
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Oscar
Top achievements
Rank 2
answered on 21 Feb 2014, 05:42 PM
Good Day,
I want to allow the item selection, but with only one click ( on click event, ) let the multiselection ( if I had CTRL key pressed ).
Is there some property for use selection with one click and simulate CTRL press?
Thanks a lot.
Oscar
I want to allow the item selection, but with only one click ( on click event, ) let the multiselection ( if I had CTRL key pressed ).
Is there some property for use selection with one click and simulate CTRL press?
Thanks a lot.
Oscar
0
Hi Oscar,
Thank you for writing.
Currently, this functionality is not supported in RadListView. However it can be achieved by using the ItemMouseDown and ItemMouseUp events. For example you can store the selected items in the ItemMouseDown and restore them in ItemMouseUp event handler:
If you have any questions, please do not hesitate to contact us.
Regards,
Dimitar
Telerik
Thank you for writing.
Currently, this functionality is not supported in RadListView. However it can be achieved by using the ItemMouseDown and ItemMouseUp events. For example you can store the selected items in the ItemMouseDown and restore them in ItemMouseUp event handler:
List<ListViewDataItem> selected =
null
;
void
radListView1_ItemMouseDown(
object
sender, ListViewItemMouseEventArgs e)
{
selected = radListView1.SelectedItems.ToList();
if
(!selected.Contains(e.Item))
{
selected.Add(e.Item);
}
else
{
selected.Remove(e.Item);
}
}
void
radListView1_ItemMouseUp(
object
sender, ListViewItemMouseEventArgs e)
{
radListView1.SelectedItems.Clear();
radListView1.Select(selected.ToArray());
}
If you have any questions, please do not hesitate to contact us.
Regards,
Dimitar
Telerik