AngelEyes on .Net

Tips, tricks and WTFs about Asp .Net, SQL Server and the likes.
posts - 54 , comments - 235 , trackbacks - 6

My Links


Tag Cloud


3rd party

Official ASP .NET

Useful info

Monday, June 29, 2009

keyboard shortcut collapse all nodes in the Solution Explorer

How to quickly collapse all nodes in the Solution Explorer (To my knowledge, this works with Visual Studio 2005 as well as Visual Studio 2008):

1. Create a macro (code taken from Jay Harris's blog. Update: I cannot find that post anymore. Good thing I copied it here!)

Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports System.Diagnostics

Public Module CollapseAll
    Sub CollapseAll()
        ' Get the the Solution Explorer tree 
        Dim UIHSolutionExplorer As UIHierarchy
        UIHSolutionExplorer = DTE.Windows.Item(Constants.vsext_wk_SProjectWindow).Object()
        ' Check if there is any open solution 
        If (UIHSolutionExplorer.UIHierarchyItems.Count = 0) Then
            ' MsgBox("Nothing to collapse. You must have an open solution.") 
        End If
        ' Get the top node (the name of the solution) 
        Dim UIHSolutionRootNode As UIHierarchyItem
        UIHSolutionRootNode = UIHSolutionExplorer.UIHierarchyItems.Item(1)
        UIHSolutionExplorer = Nothing
        UIHSolutionRootNode.DTE.SuppressUI = True
        ' Collapse each project node 
        Dim UIHItem As UIHierarchyItem
        For Each UIHItem In UIHSolutionRootNode.UIHierarchyItems
            'UIHItem.UIHierarchyItems.Expanded = False 
            If UIHItem.UIHierarchyItems.Expanded Then
            End If
        ' Select the solution node, or else when you click 
        ' on the solution window 
        ' scrollbar, it will synchronize the open document 
        ' with the tree and pop 
        ' out the corresponding node which is probably not what you want. 
        UIHSolutionRootNode.DTE.SuppressUI = False
        UIHSolutionRootNode = Nothing
    End Sub

    Private Sub Collapse(ByVal item As UIHierarchyItem)
        For Each eitem As UIHierarchyItem In item.UIHierarchyItems
            If eitem.UIHierarchyItems.Expanded AndAlso eitem.UIHierarchyItems.Count > 0 Then
            End If
        item.UIHierarchyItems.Expanded = False
    End Sub

End Module

2.  As shown here, create a new keyboard shortcut for your new macro:
•    Choose Tools/Options and select Environment/Keyboard.
•    Type in something into "Show commands containing" to get a list of matching commands. If there is already a shortcut for the selected command, it’ll be displayed in "Shortcuts for selected command".
•    To assign a new shortcut to the selected command, put the cursor in "Press shortcut keys" and press the shortcut key or key combinations desired.

Posted On Monday, June 29, 2009 7:26 AM | Comments (1) |

Setting up Right-to-Left menu, with ASP .Net CSS friendly control adapters

A great article, albeit in Hebrew, explains How to align RTL (Right-to-left) ASP.Net 2.0 Menu with CSS Control Adapters.

Note, in particular, this change:
  /* Tier 3+ */
.SimpleEntertainmentMenu ul.AspNet-Menu ul ul
    top: -0.5em;   
    left: 6em;

Changed to:

  /* Tier 3+ */
.SimpleEntertainmentMenu ul.AspNet-Menu ul ul
    top: -0.5em;   
    right: 6em;

Posted On Monday, June 29, 2009 4:15 AM | Comments (1) |

Powered by: