Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

How to Pass a ListView to a Custom DataGridViewListViewCell?

$
0
0

On MSDN, there is a page for How to: Host Controls in Windows Forms DataGridView Cells.  This example uses a DatePicker as to illustrate creation of a custom control. 

I want to use this How To example to create a custom DataGridViewListViewCell class with a corresponding DataGridViewListViewColumn and a DataGridViewListViewEditingControl.  The column class would inherit DataGridViewTextBoxColumn and the cell class would inherit DataGridViewTextBoxCell.  Clicking on the cell would cause a ListView to be displayed beneath the DataGridViewTextBoxCell.

My problem is that I do not know how to pass a runtime ListView to the editing control without having the editing control inherit a CustomListView class in which creation of the data has already been hard-coded.  Ideally, the DataGridViewTextBoxCell would have a "ListViewSource" property that could be set with a ListView that is generated in a form's code-behind.

In another of my posts on this same subject, Barry Wang kindly pointed me to Use ListView control for editing cell in DataGridView.  This example is derived fromHow to: Host Controls in Window Forms DataGridView Cells.  It requires a custom ListView class with the ListView already hard coded and is NOT what I am looking for.


Rob E.


Viewing all articles
Browse latest Browse all 2535


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>