需要在WPF中进行全屏弹出

时间:2014-05-28 06:23:50

标签: wpf xaml popup

我想打开全屏弹出窗口,但现在发生的是从顶部增加但底部透明或任何颜色效果都不可见。下面是我正在使用的代码。请告诉我哪里错了。请参阅弹出式设计CLICK HERE

<Popup  StaysOpen="False" x:Name="popintaling" Width="{Binding Source={x:Static SystemParameters.FullPrimaryScreenWidth}}"  Placement="Center" IsOpen="False" Height="900"   Panel.ZIndex="1"  HorizontalAlignment="Center"  VerticalAlignment="Center" AllowsTransparency="True" PopupAnimation="Fade" ClipToBounds="True" OpacityMask="#FFFFAA00" RenderTransformOrigin="0,0" >
            <Popup.Effect>
                <DropShadowEffect/>
            </Popup.Effect>
            <Border  Width="{Binding Source={x:Static SystemParameters.FullPrimaryScreenWidth}}" Height="900" BorderBrush="#7F1D1A1A" Margin="0,0,0,0" BorderThickness="300,300,300,300" HorizontalAlignment="Center" >

                    <Canvas Margin="0,100,0,90"  Height="800" Width="{Binding Source={x:Static SystemParameters.FullPrimaryScreenWidth}}" Panel.ZIndex="999" HorizontalAlignment="Center"  VerticalAlignment="Center" Background="#FFF3800C" >
             //some code here
                    </Canvas>

            </Border>
        </Popup>

3 个答案:

答案 0 :(得分:3)

弹出窗口覆盖超过 75%的屏幕,首先减小其宽度,然后降低其高度,以达到75%的最大覆盖率限制。您无法覆盖使它全屏。

阅读文档:PlacementMode

答案 1 :(得分:1)

after InitializeComponent in constructor, set popup child width and height from code

(popintaling.Child as FrameworkElement).Height = Window.Current.Bounds.Height;
(popintaling.Child as FrameworkElement).Width = Window.Current.Bounds.Width;

答案 2 :(得分:0)

全屏弹出窗口不是弹出窗口。只需将该代码放入具有背景颜色的边框中,然后自己处理事件。另外,为了使您的应用程序全屏,只需将 WindowState 设置为最大化,将 WindowStyle 设置为