Silverlight Accordion control: all collapsed when loaded
I'm currently working on a project where I have an Accordion control on the MainPage. It all works just as intended, but there's a small problem that I cannot seem to get my head around.
When I load the page, the first accordion is expanded. Is there any work-around to tell the Acco开发者_高级运维rdion control, that all the accordions should be collapsed when first loaded?
Also, I can click to expand the items, but when I click on the same item that I just expanded, it won't collapse again. Anyone know which event I should reach for here?
Thanks in advance.
All the best,
Bo
You need to change the SelectionMode
property to ZeroOrOne
the default is One
which means it will insist on having at least one item open.
Set the SelectedIndex
property to -1 to hide all items.
精彩评论