none
Button flyout is somehow height locked RRS feed

  • Question

  • I can't figure this bug out, so I stripped it to the simplest version where it still happens.

    This is my XAML code:

    <Grid>
        <Button x:Name="button1" Content="Button" VerticalAlignment="Top">
            <Button.Flyout>
                <Flyout Placement="Right">
                    <Flyout.FlyoutPresenterStyle>
                        <Style TargetType="FlyoutPresenter">
                            <Setter Property="Padding" Value="0"/>
                            <Setter Property="Margin" Value="0"/>
                            <Setter Property="BorderThickness" Value="0"/>
                        </Style>
                    </Flyout.FlyoutPresenterStyle>
                    <Grid Name="PopupGrid" Background="Aqua"/>
                </Flyout>
            </Button.Flyout>
        </Button>
    </Grid>

    And then I have one event for that page:

    private void Page_SizeChanged(object sender, SizeChangedEventArgs e)
    {
        PopupGrid.Height = Window.Current.Bounds.Height;
    }

    So the expected behavior for that code is as follows: Upon pressing the button, a popup opens, which is vertically stretched across the window. And this works flawlessly, until I make my window too tall. Here's a GIF of what I'm describing: gfycat.com/SociableHeartfeltHeifer (Thank MSDN's wonderful account verification process for that non-clickable link)

    As you can see, the popup clearly thinks that it should be the height of the window, but for some reason it just stops expanding at some point, and adds a scrollbar.

    Am I just not seeing something here? Or do these Flyouts have some arbitrary maximum height that I've never heard of?


    • Edited by guyyst Monday, December 26, 2016 1:39 AM
    Monday, December 26, 2016 1:38 AM

Answers

  • Hi guyyst,

    You are right. FlyoutPresenter has MaxHeight property. Set the value large enough in the Style.

    <Setter Property="MaxHeight" Value="1000000"/>


    • Edited by FEC-4RP Tuesday, December 27, 2016 2:24 AM
    • Proposed as answer by Breeze LiuModerator Tuesday, January 3, 2017 1:30 AM
    • Marked as answer by guyyst Tuesday, January 3, 2017 5:50 PM
    Monday, December 26, 2016 3:16 AM
  • Hi guyyst,

    The default style for Windows.UI.Xaml.Controls.FlyoutPresenter has a setter:

    <Setter Property="MaxHeight" Value="{ThemeResource FlyoutThemeMaxHeight}"/>

    and the theme resources used in the default style:

    <x:Double x:Key="FlyoutThemeMaxHeight">758</x:Double>
    you can get more details about that in FlyoutPresenter styles and templates.

    Best regards,
    Breeze Liu

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Tuesday, December 27, 2016 6:21 AM
    Moderator

All replies

  • Hi guyyst,

    You are right. FlyoutPresenter has MaxHeight property. Set the value large enough in the Style.

    <Setter Property="MaxHeight" Value="1000000"/>


    • Edited by FEC-4RP Tuesday, December 27, 2016 2:24 AM
    • Proposed as answer by Breeze LiuModerator Tuesday, January 3, 2017 1:30 AM
    • Marked as answer by guyyst Tuesday, January 3, 2017 5:50 PM
    Monday, December 26, 2016 3:16 AM
  • Hi guyyst,

    The default style for Windows.UI.Xaml.Controls.FlyoutPresenter has a setter:

    <Setter Property="MaxHeight" Value="{ThemeResource FlyoutThemeMaxHeight}"/>

    and the theme resources used in the default style:

    <x:Double x:Key="FlyoutThemeMaxHeight">758</x:Double>
    you can get more details about that in FlyoutPresenter styles and templates.

    Best regards,
    Breeze Liu

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Tuesday, December 27, 2016 6:21 AM
    Moderator
  • Thanks. I ended up just setting it to positive infinity: 
    <Setter Property="MaxHeight" Value="Infinity" />

    Tuesday, January 3, 2017 5:52 PM