ListViewItem Border - Compact Framework

I have a ListView where I add as Items some ListViewItem s. The View property View set to Details . When a ListView displayed, the ListViewItem have no border (the top and bottom row that separates one item from another).

How to do to add a border to all my elements?

Example:

enter image description here

+4
source share
2 answers

For some reason, Gridlines is not supported by CF control, although the core set of ListView does. P / Call for help.

 private const uint LVM_FIRST = 0x1000; private const uint LVM_SETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 54; private const uint LVM_GETEXTENDEDLISTVIEWSTYLE = LVM_FIRST + 55; private const uint LVS_EX_GRIDLINES = 0x00000001; [DllImport("coredll.dll")] private static extern uint SendMessage(IntPtr hwnd, uint msg, uint wparam, uint lparam); public void EnableGridlines(ListView listView) { var style = SendMessage( listView.Handle, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0); style |= LVS_EX_GRIDLINES; var style = SendMessage( listView.Handle, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, style); } 
+4
source

ListView does not support GridLines in a compact structure. You can use DataGridView

+1
source

All Articles