33

I am doing a windows mobile application 6.1.

I dragged in a listview and went to columns and added columns to my list view. When I run the listview they do not show up.

I then tried to add them through C# code on page load with the follow code.

ColumnHeader header = new ColumnHeader();
            header.Text = "gkgag";
            header.Width = 100;
            header.TextAlign = HorizontalAlignment.Center;
            listView1.Columns.Add(header);

this does not work either. Why don't they show up?

mdb
  • 52,000
  • 11
  • 64
  • 62
chobo2
  • 83,322
  • 195
  • 530
  • 832

1 Answers1

90

You must use detailed view for column headers to be visible.


listView1.View = View.Details;

If that´s not the problem, column headers might be hidden behind windows systembar.

Jens Granlund
  • 4,950
  • 1
  • 31
  • 31
  • 3
    In my case the headers were behind a MenuStrip. I put the menustrip and listview in a tablelayoutpanel to solve this problem. – Adam Bruss May 07 '12 at 14:10
  • 1
    In my case, i was saving and then loading the column widths from the .config file of the app when the window opened and they happened to be zero. Sigh – slayernoah May 03 '16 at 15:13
  • 3
    In a thousand years or longer, I would never be able to guess that's the answer. I'll be driving a million circles without the assurance of finding this. Thanks! – Jenna Leaf Mar 14 '18 at 03:21
  • 1
    I had to set HeaderStyle to something not "None" – Gordon Nov 30 '22 at 11:35