Now that we're including the Telerik UI in our project, we'd like to reduce our reliance on third party controls where possible. I'm looking at replacing ObjectListView and I presume the equivalient would be RadListView.
With ObjectListView the process is:
- Define the custom MyClass
- Define the columns at design time and associate each with a Property in MyClass
- At run time, use SetObjects to set the list content to the run time defined List (of MyClass).
Is there a way to do this in RadListView without needing to maintain an external data source, or manually add each item as a new row in the ListView?
8 Answers, 1 is accepted
Thank you for writing.
According to the provided information, I think that RadListView is the suitable control for your case. Data binding is a mechanism for automatic population of RadListView with items, based on the provided data structure. RadListView support data binding either at design time or at . Please refer to the following help article demonstrating how to setup data binding: http://docs.telerik.com/devtools/winforms/listview/populating-with-data/data-binding
RadListView supports three ViewTypes – ListView, IconsView and DetailsView. You can use DetailsView which provides a grid-like interface for displaying items with more than one data fields organized in columns.
You can refer to our Demo application >> ListView >> First Look example which is quite useful for getting started with RadListView. The Demo application is available in the installation folder of the suite which is usually located at the following path: C:\Program Files (x86)\Telerik\UI for WinForms R3 2016\Examples\QuickStart\Bin
I hope this information helps. Should you have further questions I would be glad to help.
Regards,
Dess
Telerik by Progress

Thank you for writing back.
In order to activate the editor after double clicking RadListView, you can use the following code snippet:
public
RadForm1()
{
InitializeComponent();
this
.radListView1.AllowEdit =
true
;
this
.radListView1.DoubleClick+=radListView1_DoubleClick;
}
private
void
radListView1_DoubleClick(
object
sender, EventArgs e)
{
this
.radListView1.BeginEdit();
}
I hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess
Telerik by Progress


Hi, a couple more related queries (please advise if these are better posted as separate threads, or as a support ticket):
- Is it possible to change the HeaderText of the automatically generated checked column? I note it doesn't fire the ColumnCreating event, where I'd normally change this.
- Is it possible to detect if a double-click occurs below the last row in the RadListView?
Thank you for writing back.
In order to change the header text of a certain column, you can set the HeaderText property of the desired column as it is demonstrated below:
this
.radListView1.Columns[1].HeaderText =
"my header text"
;
As to the question regarding the DoubleClick event, note that you can get the DetailListViewDataCellElement and determine if the associated data item is the last one. Here is a sample code snippet:
private
void
radListView1_DoubleClick(
object
sender, EventArgs e)
{
MouseEventArgs args = e
as
MouseEventArgs;
if
(args !=
null
)
{
DetailListViewDataCellElement elementUnderMouse =
this
.radListView1.ElementTree.GetElementAtPoint(args.Location)
as
DetailListViewDataCellElement;
if
(elementUnderMouse !=
null
&& elementUnderMouse.Row ==
this
.radListView1.Items.Last())
{
this
.radListView1.BeginEdit();
}
}
}
I hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess
Telerik by Progress

Thank you, my second question is answered! The first one though:
Is it possible to change the HeaderText of the automatically generated checked column? This is the column created when CheckedMember is set. This column doesn't appear to be part of the radListView1.Columns list.
Thank you for writing back.
Indeed, the checkbox is displayed before the other cells and it doesn't have a particular column for it. You actually see the DetailListViewElement in the upper left corner above the checkboxes. If you need to have a checkbox column with a header text, it is appropriate to use a RadGridView which offers a GridViewCheckBoxColumn for such cases. Additional information is available here: http://docs.telerik.com/devtools/winforms/gridview/columns/column-types/gridviewcheckboxcolumn
I hope this information helps. If you have any additional questions, please let me know.
Regards,
Dess
Telerik by Progress