We have Windows Treeviews where we want the expansion indicators to be the arrows rather than + -. We created an AppStylist Windows 7 isl file for UltraGrids where the TreeNodeExpansionIndicator UIRole is left as not updated. We added the following code to our base TreeView control
[DllImport("uxtheme.dll", CharSet = CharSet.Unicode)]
private extern static int SetWindowTheme(IntPtr hWnd, string pszSubAppName, string pszSubIdList);
protected override void CreateHandle()
{
base.CreateHandle();
SetWindowTheme(this.Handle, "explorer", null);
}
This works great for Treeviews on Windows 7 machines, but on Windows XP SP3 machines, the + - expansion indicators still display. Would adding the arrows to the
TreeNodeExpansionIndicator UIRole have any effect for XP or does only apply to Infragistics tree views? Is there any solution for this? Thank you.
Ron
Well we're too far embedded with the windows treeview to change now, so I guess we're out of luck. Thanks for your response.
Hi Ron,
I am pretty sure that the way we implemented the UltraWinTree's ViewStyle.WindowsVista uses images that duplicate the WindowsVista style -as opposed to using the Windows API. So, I might be wrong, but I am fairly sure that if you use UltraWinTree in WindowsVista style, it will work on Windows XP.
I stand corrected on my previous statement. The isl is unrelated to the Windows TreeView. But XP will still never get the arrows, right?
I believe the isl file does have an effect on the TreeView along with the SetWindowTheme in Windows 7, because if I remove either the '...StyleManage.Load ( ...isl )" from the application start up or the 'SetWindowTheme', the + - display on the TreeView instead of the arrows. I think you answered my question, though. XP is not able to show the arrows on Windows TreeView, right?
I'm afraid I'm confused. Are you using UltraWinTree or the inbox TreeView control?
The SetWindowTheme API will not have any effect on the Infragistics UltraTree, and AppStylist will not have any effect on the inbox TreeView control.
I'm having trouble understanding how AppStylist relates to the issue. If you are using UltraWinTree, then you could use AppStylist or code to set the UltraTree's DisplayStyle to WindowsVista, which is the style that uses arrows instead of plus/minus signs.
If you are using the inbox TreeView, then it makes sense that SetWindowTheme doesn't work on Windows XP, because the style of tree you want didn't exist in Windows XP. It was introduced in Windows Vista.