Cieja Cieja - 1 year ago 163
C# Question

Show/hide Mahapps Flyout control

How can I show/hide MahApps Flyout control? Now I have:

<controls:Flyout Header="Flyout" Position="Right" Width="200" IsOpen="True">
<TextBlock FontSize="24">Hello World</TextBlock>

And it's open, but when I click the button with arrow I can't show it again.

Answer Source

You can simply use something like this:

yourMahAppFlyout.IsOpen = true;

Also you can bind the Flyout visibility to a WindowCommand (LeftWindowCommand/RightWindowCommand) so whenever you close the Flyout you can reopen using a ToggleButton (for example) from the top of the window.

        <Controls:Flyout x:Name="yourMahAppFlyout"/>

        <ToggleButton Content="Layers" 
        IsChecked="{Binding ElementName=yourMahAppFlyout, Path=IsOpen}" Cursor="Hand"/>