Vista ListView Focus/Selection style
btw: I'm using the application manifest.
Steffen
btw: I'm using the application manifest.
Steffen
You can use the SetWindowTheme() function, like so:
SetWindowTheme (hwndListView, L"explorer", NULL);
Are there some drawbacks? Is this documented some where? Which other app names are available?
Drawbacks: You can't custom draw, and you'll want to test your app again with the new style to check for new bugs. This isn't documented yet, and the final decision has not yet been made on which app names will be available. Hopefully by Beta 2 things will be more settled.
Why are these styles not always used?
Steffen
Yes and yes. These calls should work on that build and be documented in that drop of the API. We don't set the style by default for backward compatibility. Many applications looked broken, so we changed to an opt-in model.
jeff
Hi I tried your solution on a ListViewCtrl and it made the list window draw the dividing lines for the column in the background upon resize of the column.
(for example)
I change the size of the column to be 3 times as wide (during runtime). The themed window does not redraw the background of the listcontrol. If I dont theme the listcontrol then the textbox for editing an item creates a rectangle background behind the textbox, the color of the text highlight, when the editable text is changed.
Is there a way to force the now themed listview to refresh the background area of the listcontrol that is showing?
If this is still confusing... I'm resizing the column in the window. The dividers in vista are shown from top to bottom, unlike XP where the divider is only shown on resize. When I stretch the column to a larger size, to the left, the ui draws the diving line below the already existing item's rows and does not refresh. Once the column is resized the ui still doesn't refresh the background. If i use the lower scroll bar to view the extended listview then the background is repainted upon scrolling back.
Please let me know if there is a way to get the listview to refresh during the resize or refresh it imediately after the resize completes?
Thanks,
Daniel
Is your listviewctrl setup to be viewed with the LVS_REPORT flag on? because I guarantee that the issue I am seeing is accross the board when theming in my fashion. It is highly possible that we do not understand what eachother is doing.
Hope you never run into the bug I found.
Can we please get an update from the Microsoft team on SetWindowTheme(hwnd, L"explorer", NULL) ?
i.e. what window types does it support, what does it do for each window type, and what are the limitations of each.
Check out AeroStyle.xml in the SDK, classes that support SetWindowTheme("Explorer") will be mentioned there. Currently there's listview and treeview.
As mentioned there, it currently affects the item selection visuals. Since it's opt-in, if you decide to use it you should test your application thoroughly with it, since it affects things like custom draw, etc.
You should also make sure your control is double-buffered (LVS_EX_DOUBLEBUFFER , TVS_EX_DOUBLEBUFFER) if you decide to use this style.
[DllImport("uxtheme", CharSet = CharSet.Unicode)]
public extern static Int32 SetWindowTheme(IntPtr hWnd, String textSubAppName, String textSubIdList);
SetWindowTheme(listView.Handle, "explorer", null);