Nested AccordionItem. Inner AccordionItem do not expand.

Posted by Ali on Stack Overflow See other posts from Stack Overflow or by Ali
Published on 2010-04-02T13:29:35Z Indexed on 2010/04/02 17:03 UTC
Read the original article Hit count: 833

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?

© Stack Overflow or respective owner

Related posts about Silverlight

Related posts about silverlight-4.0