István Piroska
István Piroska

Reputation: 243

UWP keep Flyout open in designer for editing

Can you suggest me any workaround to keep the flyout open during designing?

For example (simplified):

<Page.Resources>
    <Flyout x:Key="FlyoutBoardSelection" Placement="Bottom" FlyoutPresenterStyle="{StaticResource FlyoutStyleDefault}" >
        <Textblock Text="I wannabe visible"/>
    </Flyout>
</Page.Resources>

<Grid>
    <Button Grid.Column="0" Grid.Row="0" Style="{StaticResource ButtonStyleDefault}" Content="OpenFlyout" Flyout="{StaticResource FlyoutBoardSelection}"/>
</Grid>

It's working well runtime but I only can designing it blindly.

Upvotes: 0

Views: 467

Answers (1)

Martin Zikmund
Martin Zikmund

Reputation: 39082

The easiest thing you can do is to put the content of the flyout on the page temporarily, design it there and then put it back into the flyout.

Even better solution would be to create a new UserControl which you could design separately and then put inside of the Flyout.

Right-click your project, select Add -> New File, there choose User Control and name it (like BoardSelectionFlyoutContent). This will create a xaml and xaml.cs files where you can design the Flyout's content with full designer support.

Once you are done, you first add the namespace to XAML references on the top of your page:

xmlns:local="using:TheNamespaceOfYourControl"

And then use it inside the Flyout:

<Flyout x:Key="FlyoutBoardSelection" Placement="Bottom" 
        FlyoutPresenterStyle="{StaticResource FlyoutStyleDefault}" >
    <local:BoardSelectionFlyoutContent />
</Flyout>

Upvotes: 1

Related Questions