Search forum for this:
Kasyan Servetsky was working on it has given some nice solution to that.
Read the discussion between Peter and Kasyan in thread.
Thanks Pankaj and Kasyan
I tried this sample before, it is awesome.....But i still don't know how to directly control the expand or collapse function inside the structure pane.
Luckly, I found another way to do it without scripting.
Expand all elements:
Hold down Alt key and click root element to expand the elements
Collapse all child elements:
Hold down Alt key and click root element to collapse the elements > release Alt key > click the root element again.
Thanks guys. Thanks for your quick reqponse and support.