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):
instead of this (semi transparent blue selection):
Can I even achieve this using WinForms?
Btw I use Windows 7.
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);
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With