Hi,
I'm using Silverlight 4 and VS 2010.
I have a StackPanel with a ItemsControl.
It's ItemTemplate is binded to it's respective DataTemplate.
It is filled with a few Expanders with a lot of data in each one.
Whenever I expand one of these Expanders I want to collapse all the remaining Expanders.
On another part of my project I have a similar structure where the Expanders are hard coded.
To achieve the same result I just go through the StackPanel.Children collection with a foreach cicle and collapse all the Expanders.
Using a Stackpanel and an ItemsControl I can't do that because the Itemscontrol is the only child on the Stackpanel.Children.
Can anyone help on how do I get to each of the Expanders using c# code behind and collapse them?
<DataTemplate x:Key="AvaliacaoDataTemplate">
<Grid>
<toolkit:Expander x:Name="ExpanderAvaliacao" Header="{Binding}" d:LayoutOverrides="Width, Height" HeaderTemplate="{StaticResource AvaliacaoDataTemplateHeader}" Style="{StaticResource StyleExpanderBlue3}" Expanded="Expander_Expanded">
<StackPanel>
<!--
</StackPanel>
</toolkit:Expander>
</Grid>
</DataTemplate>
<StackPanel x:Name="Avaliacoes">
<ItemsControl x:Name="ItemsAvaliacao" ItemTemplate="{StaticResource AvaliacaoDataTemplate}"/>
</StackPanel>
I really need some light on this issue!
Anyone?!!
Thanks.