Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vista style explorer/folder view

I am trying to have a list of large (256x256) icons in a listview similar to vista explorer windows, but the winforms' listview control doesn't look like vista's listview.

Before I dig into WPF, can someone tell me if WPF listview can do this?

Basically I get this (solid blue selection):

alt text

instead of this (semi transparent blue selection):

alt text

Can I even achieve this using WinForms?

Btw I use Windows 7.

like image 313
Joan Venge Avatar asked Jun 15 '09 16:06

Joan Venge


2 Answers

Not sure about WPF, but in WinForms you must apply 'explorer' theme to your list view to achieve Explorer-like UI.

[DllImport("uxtheme.dll")]
public extern static int SetWindowTheme(
    IntPtr hWnd,
    [MarshalAs(UnmanagedType.LPWStr)] string pszSubAppName,
    [MarshalAs(UnmanagedType.LPWStr)] string pszSubIdList);

SetWindowTheme(listView.Handle, "explorer", null);
like image 83
arbiter Avatar answered Nov 09 '22 01:11

arbiter


Yes you can achieve this in WPF; you can use a Trigger as described in the MSDN article: How to: Use Triggers to Style Selected Items in a ListView.

A complete sample is also available for download.

I am uncertain if this is possible in WinForms.

Update: In response to the question in the comment below this is definitely possible. Once again there is a sample online at MSDN titled ListView That Sorts Data Sample.

like image 1
Richard McGuire Avatar answered Nov 09 '22 02:11

Richard McGuire