3

I'd like to show a listview in a C# application where every row represents a product so the property "view" is set on "detail". One column (the last one) should be a checkbox because it represents if the product is discountinued.

With the checkboxes property set to true, a checkbox appear in the first column so it doesn't work for my application.

How can add the checkbox to the last column? Thank you

0

1 Answer 1

3

The Checkboxes are always associated with the first Column. However you change re-order the display of the Columns.

All you need to do it go to the Columns designer and set the 1st colum's DisplayIndex to the last column's index.

enter image description here

Or do it in code:

listView1.Columns[0].DisplayIndex = listView1.Columns.Count - 1;
listView1.Invalidate();

Note the Invalidate which is necessary to enforce the display of the new layout..

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.