This project has moved. For the latest updates, please go here.

AccordionItem Grows Once when Children Added


When children are added to an AccordionItem the ExpandablecontentControl expands the first time, but not on subsequent children being added.
To reproduce expand the top item then press the button to add a TextBlock. The accordion size increases. When the button is clicked again the size does not change, but if you expand and collapse the accordion item the correct size is set.
<UserControl 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" x:Class="SilverlightApplication16.MainPage"
xmlns:d="" xmlns:mc="" 
mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
<Grid x:Name="LayoutRoot">
    <StackPanel Orientation="Vertical">
        <Button Click="Button_Click" Content="Click Me To Add Text Box"></Button>
        <layoutToolkit:Accordion SelectionMode="ZeroOrMore">
            <layoutToolkit:AccordionItem x:Name="ac1" >
                <StackPanel Orientation="Vertical" x:Name="sp2">
                    <TextBlock Text="1"></TextBlock>
                <StackPanel Orientation="Vertical" x:Name="sp3">
                    <TextBlock Text="2"></TextBlock>
                <StackPanel Orientation="Vertical" x:Name="sp4">
                    <TextBlock Text="3"></TextBlock>
                <StackPanel Orientation="Vertical" x:Name="sp5">
                    <TextBlock Text="4"></TextBlock>
        <controlsToolkit:Expander ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" MaxHeight="200">
            <StackPanel Orientation="Vertical" x:Name="sp"></StackPanel>
        <TextBlock Text="End"></TextBlock>
namespace SilverlightApplication16
public partial class MainPage : UserControl
    int _i = 0;
    public MainPage()
    private void Button_Click(object sender, RoutedEventArgs e)
        TextBlock tb = new TextBlock();
        tb.Text = "New Row" + _i;



epodolyak wrote Aug 25, 2009 at 4:29 PM

Is there any workaround until it not fixed?

jd_hixon wrote Aug 26, 2009 at 7:46 AM

It appears as though the ExpandableContentControl is given a fixed height. If you propogate the visual tree and find the expandable content control and set the height to Double.NaN it will expand. However, some actions (I don't have a full list) appear to reset the height.

epodolyak wrote Aug 26, 2009 at 1:25 PM

Great, it helped, thanks!

jd_hixon wrote Aug 27, 2009 at 7:18 AM

You may also want to checkout this thread

wrote Aug 28, 2009 at 3:43 PM

wrote Sep 2, 2009 at 4:17 AM

wrote Oct 13, 2009 at 7:55 AM

wrote Feb 2, 2012 at 8:05 PM

wrote Apr 5, 2012 at 1:41 AM

wrote Feb 22, 2013 at 1:52 AM