views:

642

answers:

2
+1  A: 

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.

Richard C. McGuire
Thanks Rick. Do you also know if it's possible to have the exact explorer functionality (for viewing files) with custom filtering, etc?
Joan Venge
Joan, see the update above.
Richard C. McGuire
Thanks Rich. .....
Joan Venge
+2  A: 

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);
arbiter