开发者

Winform ListView databind

开发者 https://www.devze.com 2022-12-26 06:33 出处:网络
I have a Listview that uses databind. I set the DataSource property to a binding source. All works fine. The p开发者_如何学Croblem is that I need to have a column that is not databinded and contains o

I have a Listview that uses databind. I set the DataSource property to a binding source. All works fine. The p开发者_如何学Croblem is that I need to have a column that is not databinded and contains only buttons that have the same handler for click event. To accomplish this I tried to add a subitem that is a button for each ListViewItem after InitializeComponent but doesn't work, nothing is displayed. Also I set the list view column type to Control. If I add elements to ListView and isn't databinded that the buttons appear.

So it will be a great help for me to know if buttons could be displayed in column that is not databinded when the listview uses databinding for rest of columns.

Thanks!


The best thing to do here (assuming you mean ListBox), is to have a single button above or below the listbox, that uses the ListBox.SelectedItem property to investigate the selected item and do something with it.

0

精彩评论

暂无评论...
验证码 换一张
取 消