Expander does not push the controls down when expanded

3 posts, 1 answers
  1. Avinash
    Avinash avatar
    31 posts
    Member since:
    May 2015

    Posted 13 Jun 2015 Link to this post

    Hi, 

     I added couple expanders inside a stackPanel. But my stackPanel takes up full height into consideration, irrespective of Expander's state. Kindly help me figure out what I missed on Expander's setting.

    <ScrollViewer Grid.Row="1" Panel.ZIndex="5">
        <Grid x:Name="MainArea" VerticalAlignment="Top">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="1*"/>
                <ColumnDefinition Width="1*"/>
            </Grid.ColumnDefinitions>
            <StackPanel CanVerticallyScroll="True" ScrollViewer.VerticalScrollBarVisibility="Auto">
                <telerik:RadExpander x:Name="ReportSection" Height="120" Margin="10,10,10,10" VerticalAlignment="Top" FontFamily="Trebuchet MS" Foreground="#FF0081A7" Header="Report Section Name" BorderBrush="#FF0081A7" BorderThickness="1">
                    <telerik:RadExpander.Content>
                        <StackPanel>
                            <CheckBox x:Name="AddToReport" Content="ADD TO REPORT" HorizontalAlignment="Left" VerticalAlignment="Top" Width="150" Height="30" VerticalContentAlignment="Center" BorderBrush="#FF0081A7" Foreground="#FF0081A7" IsChecked="True" FontFamily="Trebuchet MS" />
                            <telerik:RadRichTextBox x:Name="radRichTextBox" DocumentInheritsDefaultStyleSettings="True" Height="auto" HorizontalScrollBarVisibility="Hidden" IsSelectionMiniToolBarEnabled="True" IsSpellCheckingEnabled="True" IsContextMenuEnabled="True" Margin="10" VerticalScrollBarVisibility="Auto" Width="Auto"/>
                        </StackPanel>
                    </telerik:RadExpander.Content>
                </telerik:RadExpander>
                <telerik:RadExpander x:Name="ReportSection2" Height="120" Margin="10,10,10,10" VerticalAlignment="Top" FontFamily="Trebuchet MS" Foreground="#FF0081A7" Header="Report Section Name" BorderBrush="#FF0081A7" BorderThickness="1" VerticalContentAlignment="Top" HorizontalContentAlignment="Left" RenderTransformOrigin="0.493,0.856">
                    <telerik:RadExpander.Content>
                        <StackPanel>
                            <CheckBox x:Name="AddToReport2" Content="ADD TO REPORT" HorizontalAlignment="Left" VerticalAlignment="Top" Width="150" Height="30" VerticalContentAlignment="Center" BorderBrush="#FF0081A7" Foreground="#FF0081A7" IsChecked="True" FontFamily="Trebuchet MS" />
                            <telerik:RadRichTextBox x:Name="radRichTextBox2" DocumentInheritsDefaultStyleSettings="True" Height="auto" HorizontalScrollBarVisibility="Hidden" IsSelectionMiniToolBarEnabled="True" IsSpellCheckingEnabled="True" IsContextMenuEnabled="True" Margin="10" VerticalScrollBarVisibility="Auto" Width="Auto"/>
                        </StackPanel>
                    </telerik:RadExpander.Content>
                </telerik:RadExpander>
                <telerik:RadExpander x:Name="ReportSection3" Height="120" Margin="10,10,10,10" VerticalAlignment="Top" FontFamily="Trebuchet MS" Foreground="#FF0081A7" Header="Report Section Name" BorderBrush="#FF0081A7" BorderThickness="1">
                    <telerik:RadExpander.Content>
                        <StackPanel>
                            <CheckBox x:Name="AddToReport3" Content="ADD TO REPORT" HorizontalAlignment="Left" VerticalAlignment="Top" Width="150" Height="30" VerticalContentAlignment="Center" BorderBrush="#FF0081A7" Foreground="#FF0081A7" IsChecked="True" FontFamily="Trebuchet MS" />
                            <telerik:RadRichTextBox x:Name="radRichTextBox3" DocumentInheritsDefaultStyleSettings="True" Height="auto" HorizontalScrollBarVisibility="Hidden" IsSelectionMiniToolBarEnabled="True" IsSpellCheckingEnabled="True" IsContextMenuEnabled="True" Margin="10" VerticalScrollBarVisibility="Auto" Width="Auto"/>
                        </StackPanel>
                    </telerik:RadExpander.Content>
                </telerik:RadExpander>
                <telerik:RadExpander x:Name="ReportSection4" Height="120" Margin="10,10,10,10" VerticalAlignment="Top" FontFamily="Trebuchet MS" Foreground="#FF0081A7" Header="Report Section Name" BorderBrush="#FF0081A7" BorderThickness="1">
                    <telerik:RadExpander.Content>
                        <StackPanel>
                            <CheckBox x:Name="AddToReport4" Content="ADD TO REPORT" HorizontalAlignment="Left" VerticalAlignment="Top" Width="150" Height="30" VerticalContentAlignment="Center" BorderBrush="#FF0081A7" Foreground="#FF0081A7" IsChecked="True" FontFamily="Trebuchet MS" />
                            <telerik:RadRichTextBox x:Name="radRichTextBox4" DocumentInheritsDefaultStyleSettings="True" Height="auto" HorizontalScrollBarVisibility="Hidden" IsSelectionMiniToolBarEnabled="True" IsSpellCheckingEnabled="True" IsContextMenuEnabled="True" Margin="10" VerticalScrollBarVisibility="Auto" Width="Auto"/>
                        </StackPanel>
                    </telerik:RadExpander.Content>
                </telerik:RadExpander>
            </StackPanel>
        </Grid>
    </ScrollViewer>

  2. Answer
    Martin
    Admin
    Martin avatar
    1099 posts

    Posted 15 Jun 2015 Link to this post

    Hello Avinash,

    The described behavior is expected due the fact that the RadExpander controls have their Height property set. If you want to display only the header when the expander is collapsed you can remove the Height set (this will change it to Auto as its default value) and instead set the Height of the expander's Content.

    Please try this and let me know if this helps.

    Regards,
    Martin
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. Avinash
    Avinash avatar
    31 posts
    Member since:
    May 2015

    Posted 16 Jun 2015 in reply to Martin Link to this post

    Thanks. It works flawlessly now. 
Back to Top