Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expander is not using all available space after expanding inside Grid with ScrollViewer outside #3436

Closed
DrCQ opened this issue Jan 17, 2024 · 1 comment · Fixed by #3457
Closed
Assignees
Labels
Milestone

Comments

@DrCQ
Copy link

DrCQ commented Jan 17, 2024

Bug explanation

I have 3 Expander controls inside the Grid surrounded by the ScrollViewer. The intention is that the third Expander should - in the open state - always use all available space. To explain the problem following XAML is used:

<Grid>
  <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
    <Grid >
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <Expander Grid.Row="0" Header="Fix hight 200" Margin="5">
            <Grid Height="200" Background="Yellow"/>
        </Expander>
        <Expander Grid.Row="1" Header="Fix hight 100" Margin="5">
            <Grid Height="100" Background="Green"/>
        </Expander>
        <Expander Grid.Row="2" Header="Maximal hight" Margin="5" Style="{x:Null}">
            <Grid Background="Blue" MinHeight="400"/>
        </Expander>
    </Grid>
  </ScrollViewer>
</Grid>

Setting the Expander Style to Null shows the proper behavior. Using the MaterialDesign default Styleshows, that the Expander is growing to the MinHeight value of the blue Grid inside only!

Window with Height set to 750 perfectly shows the expected behavior between ScrollViewer and Expanders.

Version

4.9.0

@DrCQ DrCQ added bug evaluation required Items is pending review or evaluation by the team labels Jan 17, 2024
@Keboo Keboo added this to the 5.1.0 milestone Feb 8, 2024
@nicolaihenriksen
Copy link
Contributor

@DrCQ I believe this a simple matter of the VerticalContentAlignment of the Expander defaults to Top in MDIX, rather than Stretch which is the default value in the default style. If you explicitly set VerticalContentAlignment=Stretch on your Expander, I believe you get the expected behavior.

I have added a PR to change the default value because I think it is better to follow the default templates unless there is a specific reason not to; which I don't believe there is in this case.

@nicolaihenriksen nicolaihenriksen removed the evaluation required Items is pending review or evaluation by the team label Feb 12, 2024
@nicolaihenriksen nicolaihenriksen self-assigned this Feb 12, 2024
@Keboo Keboo modified the milestones: 5.1.0, 5.0.0 Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants