There is a window on how to make it so that after clicking on the button, a page opens inside this window, while it moves along with the window, the background of the window darkens and when you click on, all the elements of the window become non-clickable.
CodePudding user response:
You don't necessarily need actual Flyout. The combination of ordinary Grid
s would surffice.
<Window x:Class="WpfApp1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="800" Height="400">
<Grid>
<!-- Main content -->
<!-- Flyout Grid -->
<Grid Visibility="Visible"
Background="#22000000">
<Grid Width="400" Height="300" Background="Black">
<TextBlock Text="Flyout" Foreground="White"
HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
</Grid>
</Grid>
</Window>
This Flyout Grid covers the entire Window and looks as a Flyout. You can show/hide this Grid by changing its Visibility
somehow by binding.
Edit
Assuming you have a System.Windows.Controls.Page
named "FlyoutPage", You can add it in design time:
<!-- Flyout Grid -->
<Grid Visibility="Visible"
Background="#22000000">
<Grid x:Name="FlyoutGrid" Width="400" Height="300" Background="Black">
<Frame>
<Frame.Content>
<local:FlyoutPage/>
</Frame.Content>
</Frame>
</Grid>
</Grid>
You can add it at run time as well.
this.FlyoutGrid.Children.Clear();
this.FlyoutGrid.Children.Add(new Frame { Content = new FlyoutPage() });
CodePudding user response:
If you are not bound to the default WPF controls, you could check out