locked
using the expander box in blend 3 RRS feed

  • Question

  • hey there
    probably a newbie question, but i have an expander box at the top of my main form with a list box below it. The behaviour i'm after is that when the expander box is openned, it pusshes the top of the list box down. when it is closed, i want the list box to stretch up to the expander header. I can't work out how to do this in Blend 3. seems that i have to use grids and anchoring within these, but i just can't work out how to do it. its probably something simple?
    i hope someone can help me.

    cheers
    gus
    Tuesday, March 9, 2010 10:53 PM

Answers

  • Put the expander and other items into a stack panel, and be sure the width/height are set to auto, here is a simple example:
    <StackPanel Margin="282,39,90,37">
    			<Expander Margin="0,0,0,0" Header="Expander" IsExpanded="True">
    				<StackPanel Background="#FFFFC1C1">
    					<TextBlock HorizontalAlignment="Left" TextWrapping="Wrap"><Run Text="TextBlock"/></TextBlock>
    					<TextBlock HorizontalAlignment="Left" Text="TextBlock" TextWrapping="Wrap"/>
    					<TextBlock HorizontalAlignment="Left" Text="TextBlock" TextWrapping="Wrap"/>
    					<TextBlock HorizontalAlignment="Left" Text="TextBlock" TextWrapping="Wrap"/>
    					<TextBlock HorizontalAlignment="Left" Text="TextBlock" TextWrapping="Wrap"/>
    				</StackPanel>
    			</Expander>
    			<ListBox>
    				<ListBoxItem Content="ListBoxItem"/>
    				<ListBoxItem Content="ListBoxItem"/>
    				<ListBoxItem Content="ListBoxItem"/>
    				<ListBoxItem Content="ListBoxItem"/>
    			</ListBox>
    		</StackPanel>
    Wednesday, March 10, 2010 2:15 PM
    Moderator