Using WPF .NET 4.0 in VS2010 RTM: I can't create a fullscreen WPF popup.
If I create a popup that is sized 50% width and 100% height everything works fine, but if I try to create a "full screen" popup sized to 100% width and height it ends up displaying at 100% width and 75% height... the bottom is truncated.
Note: The width and height are actually being expressed in pixels in code, I'm using percent to make the situation a little more understandable...
It "feels" like there is some sort of limit preventing the area of a popup from exceeding ~75% of the total area of the screen.
UPDATE: Here is a Hello World example that shows the problem.
<Window x:Class="TechnologyVisualizer.PopupTest"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="PopupTest"
WindowStyle="None" WindowState="Maximized" Background="DarkGray">
<Canvas x:Name="MainCanvas" Width="1920" Height="1080">
<Popup Placement="Center" VerticalAlignment="Center" HorizontalAlignment="Center" Width="1900" Height="1060" Name="popContent">
<TextBlock Background="Red">Hello World</TextBlock>
</Popup>
<Button Canvas.Left="50" Canvas.Top="50" Content="Menu" Height="60" Name="button1" Width="80"
FontSize="22" Foreground="White" Background="Black" Click="button1_Click" />
</Canvas>
</Window>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace TechnologyVisualizer
{
/// <summary>
/// Interaction logic for PopupTest.xaml
/// </summary>
public partial class PopupTest : Window
{
public PopupTest()
{
InitializeComponent();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
popContent.IsOpen = true;
}
}
}
If you run this the bottom 25% of the popup is missing if you change the width of the popup to 500 then it will go full height
Your guess about the size limitation (75% of the screen) is correct. It's documented here:
http://msdn.microsoft.com/en-us/library/system.windows.controls.primitives.placementmode%28VS.85%29.aspx
The relevant note is missing from the .NET 4 docs. I think you'll need to use another method of getting full screen. I normally use a maximized, borderless, non-resizable window.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With