3 Answers, 1 is accepted
0
Hello Velkumar,
Thank you for writing.
You can see an example on how to add elements to a ListViewItem in our online documentation. List view items have build in check boxes, you can read more on how to use them again in our documentation.
I hope this will be useful. Should you have further questions, I would be glad to help.
Regards,
Ivan Petrov
the Telerik team
Thank you for writing.
You can see an example on how to add elements to a ListViewItem in our online documentation. List view items have build in check boxes, you can read more on how to use them again in our documentation.
I hope this will be useful. Should you have further questions, I would be glad to help.
Regards,
Ivan Petrov
the Telerik team
RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
0
Seshu
Top achievements
Rank 1
answered on 26 Jan 2015, 09:33 PM
Can you add dropdown list to list view as one column? How do you do that?
Thank you
Seshu
Thank you
Seshu
0
Hello Seshu,
Thank you for contacting us.
If I understand your requirement correctly, you are trying to display drop down list for a specific column. For this purpose, you can use a custom DetailListViewDataCellElement and override the CreateChildElements where you can add a RadDropDownListElement to the Children collection. The result from the following code snippet is illustrated on the attached screenshot:
Note that RadDropDownListElement hosts the MS TextBox if the DropDownStyle property is set to DropDown. Using controls in RadListView cells may slow down the scrolling and will cause visual glitches as they do not support clipping. A better option would be using custom editors. Please refer to ListView >> Checkboxes and editors help article >> Switching Editors section.
I hope this information helps. Should you have further questions, I would be glad to help.
Regards,
Dess
Telerik
Thank you for contacting us.
If I understand your requirement correctly, you are trying to display drop down list for a specific column. For this purpose, you can use a custom DetailListViewDataCellElement and override the CreateChildElements where you can add a RadDropDownListElement to the Children collection. The result from the following code snippet is illustrated on the attached screenshot:
private
void
radListView1_CellCreating(
object
sender, ListViewCellElementCreatingEventArgs e)
{
DetailListViewDataCellElement cell = e.CellElement
as
DetailListViewDataCellElement;
if
(cell !=
null
&& cell.Data.Name ==
"Title"
)
{
e.CellElement =
new
CustomDetailListViewDataCellElement(cell.RowElement, e.CellElement.Data);
}
}
public
class
CustomDetailListViewDataCellElement : DetailListViewDataCellElement
{
private
RadDropDownListElement dropdown;
public
CustomDetailListViewDataCellElement(DetailListViewVisualItem owner,
ListViewDetailColumn column) :
base
(owner, column)
{
}
protected
override
void
CreateChildElements()
{
base
.CreateChildElements();
this
.dropdown =
new
RadDropDownListElement();
this
.dropdown.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDownList;
this
.dropdown.DataSource =
new
List<
string
>() {
"one"
,
"two"
,
"three"
};
this
.Children.Add(
this
.dropdown);
}
protected
override
Type ThemeEffectiveType
{
get
{
return
typeof
(DetailListViewHeaderCellElement);
}
}
public
override
void
Synchronize()
{
base
.Synchronize();
this
.Text =
""
;
}
}
Note that RadDropDownListElement hosts the MS TextBox if the DropDownStyle property is set to DropDown. Using controls in RadListView cells may slow down the scrolling and will cause visual glitches as they do not support clipping. A better option would be using custom editors. Please refer to ListView >> Checkboxes and editors help article >> Switching Editors section.
I hope this information helps. Should you have further questions, I would be glad to help.
Regards,
Dess
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.