Can't create a fullscreen WPF popup

Posted by Scrappydog on Stack Overflow See other posts from Stack Overflow or by Scrappydog
Published on 2010-04-13T20:55:51Z Indexed on 2010/04/13 22:13 UTC
Read the original article Hit count: 1500

Filed under:
|

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

© Stack Overflow or respective owner

Related posts about .NET

Related posts about wpf