views:

170

answers:

1

In Silverlight an AccordionItem is inside another one . When the inner one is selected, it can not expand its parent more which is already expanded to show its own content.

I tried to get around it by templating but I was unlucky. Does any one has a solution for it [prefer a solution without code]?

<UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:layoutPrimitivesToolkit="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Layout.Toolkit" xmlns:layoutToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Layout.Toolkit" xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
x:Class="NestedAccordion_Silverlight.MainPage"
Width="640" Height="480">
<Grid x:Name="LayoutRoot" Background="White">
    <layoutToolkit:Accordion BorderBrush="#FF00FF53" SelectionMode="ZeroOrMore">
        <layoutToolkit:AccordionItem Header="Header" VerticalAlignment="Top" >
            <StackPanel VerticalAlignment="Top">
                <TextBlock TextWrapping="Wrap" Text="Some content"/>
                <Button Content="Button" Width="75"/>
                <layoutToolkit:AccordionItem Header="Inner Accordion1" VerticalAlignment="Top" >
                    <StackPanel VerticalAlignment="Top">
                        <TextBlock TextWrapping="Wrap" Text="Some content"/>
                        <Button Content="Button" Width="75"/>
                    </StackPanel>
                </layoutToolkit:AccordionItem>
            </StackPanel>
        </layoutToolkit:AccordionItem>
        <layoutToolkit:AccordionItem Header="Header" VerticalAlignment="Top" >
            <StackPanel>
                <TextBlock TextWrapping="Wrap" Text="Some content"/>
                <Button Content="Button" Width="75"/>
            </StackPanel>
        </layoutToolkit:AccordionItem>
        <layoutToolkit:AccordionItem Header="Header" VerticalAlignment="Top" >
            <StackPanel>
                <TextBlock TextWrapping="Wrap" Text="Some content"/>
                <Button Content="Button" Width="75"/>
            </StackPanel>
        </layoutToolkit:AccordionItem>
    </layoutToolkit:Accordion>
</Grid>

Is it a bug or I am in a wrong path?

A: 

I think this is the same problem I reported on the CodePlex. I had to resort to always closing the outer accordion item when it is no longer needed. After expanding, it does adjust to the new client size.

Sergey Aldoukhov