How can i select all the row in ObjectListView?
Asked Answered
C

1

7

I'm using ObjectListView in winforms application, and i encountered a problem, in my List i wont if i click on any column of my row it should be selected (all the 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 the row only if i select titleColumn.

this is picture to demonstrate what i get (the selection only on the first column):

enter image description here

Claudeclaudel answered 15/11, 2013 at 14:37 Comment(3)
I have edited your title. Please see, "Should questions include “tags” in their titles?", where the consensus is "no, they should not".Rochdale
you can set MultiSelect property to TrueQuebec
No it dosen't work, i think MultiSelect is for selecting multiple row, but me i wont to select the row when i click on any column. hope it's clear.Claudeclaudel
S
17

It is a little bit unclear what you want to achieve., But if you are talking about this

enter image description here

VS this

enter image description here

you have to set

olvSongs.FullRowSelect = true;

If thats not what you mean please improve your question.

Spume answered 18/11, 2013 at 8:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.