Q:

Silverlight auto height problems with nested controls

I've inherited a silverlight app that now needs extending.  The app sits on a map and originally had 1 text block item and a single accordion control of options.  This has been extended so that the text block becomes an accordion item and further accordion item has been added with 2 sets of controls. 
So my plan started along the lines of
<accordionMain>
  <accordionMainItem1>
    <accordion1>
      <accordion1Item>
        <controls>
      </accordion1Item>
      <accordion1Item2>
        <controls>
      </accordion1Item2>
    </accordion1>
  <accordionMainItem1>
  <accordionMainItem2>
    <accordion2>
      <accordion2Item>
        <controls>
      </accordion2Item>
      <accordion2Item2>
        <controls>
      </accordion2Item2>
    </accordion2>
  <accordionMainItem2>
</accordionMain>

This would hopefully give me the structure that I needed to add controls to. 
Being new to Silverlight but having done a bit of XAML I made some progress but have hit a problem. 
The StackPanel and Canvas that the whole thing sits on does not resize automatically as I would like.  I'm unsure how to go about this but have tried Height="Auto" with no luck.  What I would like would be when the 2nd accordion is expanded the panel and border underneath auto size as needed. 
I have attached the full XAML here

A:

Personally, I avoid the StackPanel for non-trivial layout of controls.  I find a Grid is much more flexible when it comes to filling available space and resizing, which is normally what I want when designing an interface that will grow and shrink. 
So my first step with your example would be to define a couple of rows for your grid, and place your expanding elements into a row each.  Looking back at your example I see there is actually only one expanding thing: the AccordianMain, so make sure that is in a Row where Height="Auto". 
What are you using the Canvas for incidentally?  And why is the Grid that contains the accordians on the Canvas, and the only item in the StackPanel the Canvas? 
Try and simplify your layout, I don't see why your inner Grid can't be directly placed into your Border and so can't see what the StackPanel or Canvas are bringing to the party.  But maybe I'm missing something.