WPF里Popup怎么大到一定限度就显示不完整了呢?

huangyannew 2013-01-09 05:05:41
<Window x:Class="PopupTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow">
<Grid x:Name="M" Background="Gray" MouseLeftButtonDown="M_MouseLeftButtonDown_1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="0"/>
</Grid.ColumnDefinitions>
<Grid x:Name="Left" Grid.Column="1"/>
<Popup x:Name="pop"
Placement="Left"
PlacementTarget="{Binding ElementName=Left}"
Height="{Binding ActualHeight, ElementName=M}"
Width="{Binding ActualWidth, ElementName=M}">
<Grid Background="Red">
</Grid>
</Popup>
</Grid>
</Window>



using System;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Input;

namespace PopupTest
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void M_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e)
{
pop.IsOpen = !pop.IsOpen;
}
}
}

最大化或者拖到很大之后下面就有一部分显示不出来
为什么呢。。
...全文
674 12 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
lshappy 2014-09-01
  • 打赏
  • 举报
回复
http://doncle.blog.163.com/blog/static/162813941201391101839520/
huangyannew 2013-02-04
  • 打赏
  • 举报
回复
引用 9 楼 slowhand 的回复:
我也遇到了,可惜没人回复。 http://bbs.csdn.net/topics/390360261 同求解决方案。 貌似这个问题还挺普遍http://stackoverflow.com/questions/2633129/cant-create-a-fullscreen-wpf-popup 我准备先试试用2个popup拼接起来看能行不。实在不行只能用窗体……
果然啊MSDN里看见了。。 •A Popup that covers more than 75 percent of the screen, reduces its width first and then its height to meet the maximum coverage limit of 75 percent.
APM60- 2013-02-01
  • 打赏
  • 举报
回复
刚抽出点时间来测试了一下,2个popup拼接的方法倒是可以。 但是我的提示框要显示在屏幕正中间啊,而且要求横屏竖屏通用啊~ 我准备用3个popup拼接实现了。正中间一个方形popup,两侧(或上下)再补上2个popup。
APM60- 2013-01-31
  • 打赏
  • 举报
回复
我也遇到了,可惜没人回复。 http://bbs.csdn.net/topics/390360261 同求解决方案。 貌似这个问题还挺普遍http://stackoverflow.com/questions/2633129/cant-create-a-fullscreen-wpf-popup 我准备先试试用2个popup拼接起来看能行不。实在不行只能用窗体来实现了。
huangyannew 2013-01-31
  • 打赏
  • 举报
回复
引用 7 楼 goodnightgirl 的回复:
仅供参考。 grid放在window里,window的size限制了grid的size,你是不是window不够大?
Popup应该是放在一个新窗口里的吧 可以比window大的。 而且当前情况是Popup比window要小。
simon1990 2013-01-31
  • 打赏
  • 举报
回复
仅供参考。 grid放在window里,window的size限制了grid的size,你是不是window不够大?
huangyannew 2013-01-31
  • 打赏
  • 举报
回复
引用 5 楼 strife 的回复:
popup 窗口里面控件left,top位置的书写是否注意了?
popup 里只有一个Grid。。
嘴哥臭鼬 2013-01-30
  • 打赏
  • 举报
回复
popup 窗口里面控件left,top位置的书写是否注意了?
huangyannew 2013-01-30
  • 打赏
  • 举报
回复
引用 3 楼 nonocast 的回复:
Height="{Binding ActualHeight, ElementName=M}" Width="{Binding ActualWidth, ElementName=M}"> 这句是错的吧,因为Popup根本不知道需要多大尺寸,他哪里来的ActualWidth和Height,你需要让里面的内容顶出去 里面的Grid尤其要注意H……
Popup可以指定尺寸的吧。 而且这个代码在窗口不是很大的时候都是正常工作的。 只有窗口占了超过整个屏幕的大约80%面积以上的时候才会出问题。。很奇怪~ 我把代码改成指定内部Grid大小结果也是一样。。窗口超过一定面积的时候就显示不全了。
huangyannew 2013-01-18
  • 打赏
  • 举报
回复
引用 1 楼 yysyangyangyangshan 的回复:
不知道你碰到的是不是这种问题
谢谢。。不过应该完全不是同一个问题。。
nonocast 2013-01-18
  • 打赏
  • 举报
回复
Height="{Binding ActualHeight, ElementName=M}"                Width="{Binding ActualWidth, ElementName=M}"> 这句是错的吧,因为Popup根本不知道需要多大尺寸,他哪里来的ActualWidth和Height,你需要让里面的内容顶出去 里面的Grid尤其要注意Height的问题

            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

111,098

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧