VSConstants.VsUIHierarchyWindowCmdIds.UIHWCMDID
(1)
VsMenus.guidVsUIHierarchyWindowCmds
(1)
WPF
(1)
ExecCommandOnNode
(1)
HierarchyNode
(1)
ProjectNode
(1)
EnterKey
(1)
CmdGroup
(1)

Disabling expanding a HierarchyNode while double clicking...

Asked By Nag
19-Aug-09 03:32 PM
Hi,

I am maintaining an vs explorer (similar to solution explorer or server
explorer). My nodes are expandable items.

I want to expand them if and only if user tries to expand it with the
gesture (expandable sign, for ex: "+").
i dont want it to be expanded when user double clicks on the node.

In a way similar behaviour to "xamls" files. In WPF app when we double click
on "xaml" files we show designer and it expands if and only if users clicks
on the gesture.

It will be great if anyone points me how to do this...

thanks,
nag

I had to do the same thing in my project system.

ReedShilts replied to Nag
20-Aug-09 03:08 PM
I had to do the same thing in my project system.
If you are derived from the MPF "ProjectNode" this will work...

In your overload of "ExecCommandOnNode(...)"
catch and return S_FALSE rather than S_OK to the double-click and the
enter-key actions.  Like:

if (cmdGroup == VsMenus.guidVsUIHierarchyWindowCmds)
{
switch (cmd)
{
case
(uint)VSConstants.VsUIHierarchyWindowCmdIds.UIHWCMDID_DoubleClick:
case (uint)VSConstants.VsUIHierarchyWindowCmdIds.UIHWCMDID_EnterKey:
this.DoDefaultAction();
return VSConstants.S_FALSE;     // this prevents the
sub-nodes from opening
//return VSConstants.S_OK;
}
}


Hope this helps,
Reed Shilts

Thanks a lot Reed...it solved my problem.regards,nag"ReedShilts" wrote:

Nag replied to ReedShilts
25-Aug-09 07:34 PM
Thanks a lot Reed...

it solved my problem.

regards,
nag
Post Question To EggHeadCafe