How can I select the entire row in an ObjectListView?

I am using ObjectListView in a winforms application, and I ran into a problem, in my list I wont if I click on any column of my row should be selected (whole row).

this is my code:

olvSongs.AllColumns.Add(this.titleColumn);
olvSongs.AllColumns.Add(this.typeColumn);
olvSongs.AllColumns.Add(this.addedColumn);
olvSongs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
            | System.Windows.Forms.AnchorStyles.Left)
            | System.Windows.Forms.AnchorStyles.Right)));
olvSongs.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.titleColumn,
this.typeColumn,
this.addedColumn});
olvSongs.Location = new System.Drawing.Point(6, 40);
olvSongs.Name = "olvSongs";
olvSongs.ShowGroups = false;
olvSongs.Size = new System.Drawing.Size(638, 190);
olvSongs.SmallImageList = this.imageList1;
olvSongs.TabIndex = 7;
olvSongs.UseAlternatingBackColors = true;
olvSongs.UseCompatibleStateImageBehavior = false;
olvSongs.UseFiltering = true;
olvSongs.View = System.Windows.Forms.View.Details;

here I can select a row only if I select titleColumn.

This is an image to demonstrate what I get (selection only in the first column):

enter image description here

+4
source share
1 answer

It’s a little unclear what you want to achieve. But if you talk about it

enter image description here

VS it

enter image description here

you need to install

olvSongs.FullRowSelect = true;

If this is not what you mean, improve your question.

+12
source

All Articles