I'm trying to implement the doubleclick
function in an objectlistview
object.
According the developer, one should use ItemActivate
instead of MouseDoubleClick
.
So I came up with this:
private void treeListView_ItemActivate(object sender, EventArgs e)
{
try
{
ListView.SelectedIndexCollection col = treeListView.SelectedIndices;
MessageBox.Show(col[0].ToString());
}
catch (Exception e3)
{
globals.logfile.error(e3.ToString());
globals.logfile.flush();
}
finally
{
}
}
Which comes up with a value for each double clicked row. But how do I get the details from that row?
Here's the whole solution I'm now using:
private void treeListView_ItemActivate(object sender, EventArgs e)
{
try
{
var se = (StructureElement)treeListView.GetItem(treeListView.SelectedIndex).RowObject;
MessageBox.Show(se.id.ToString());
}
catch (Exception e3)
{
globals.logfile.error(e3.ToString());
globals.logfile.flush();
}
finally
{
}
}
I think you have to access the
RowObject
using the underlyingOLVListItem
like this:This is how I'm now getting the data out of the treelistview: