Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to let Flyout width adjust to application width?

I use Flyouts in my metro style application, which uses the MahApps Metro package:

<Controls:MetroWindow.Flyouts>
    <Controls:FlyoutsControl>
        <Controls:Flyout Header="INSTELLINGEN" Position="Left" Width="600" Theme="Dark">
            some content
        </Controls:Flyout>
    </Controls:FlyoutsControl>
</Controls:MetroWindow.Flyouts>

This works fine, however now I want a Flyout that takes up the width of the entire application, even if the user resizes it. Basically I'd like Width="*" but this doesn't work.

like image 272
user3692104 Avatar asked Oct 15 '14 13:10

user3692104


1 Answers

Here is an example that works with the latest alpha version (0.15).

Simply set the Margin and Width and you get what you need.

  <controls:MetroWindow.Flyouts>
    <controls:FlyoutsControl>
      <controls:Flyout Header="INSTELLINGEN"
                       Position="Left"
                       Margin="0 0 100 0"
                       Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=controls:MetroWindow}, Path=ActualWidth}"
                       Theme="Dark">
      </controls:Flyout>
    </controls:FlyoutsControl>
  </controls:MetroWindow.Flyouts>
like image 157
punker76 Avatar answered Oct 01 '22 19:10

punker76