Silverlight 中的 PopUp 不会被容器控件剪切
这里有一个简单但令人沮丧的问题...
我有一个 PopUp 控件。
它包含在 Grid 中,该 Grid 定义了 Grid.Clip。
PopUp 在网格的剪切区域之外仍然可见。
即
<Grid Background="Red" Width="150" Height="150">
<Grid.Clip>
<RectangleGeometry Rect="0,0,150,150" />
</Grid.Clip>
<Popup IsOpen="True" Margin="100,100,0,0">
<Grid Background="Green" Width="150" Height="150" />
</Popup>
</Grid>
理想情况下,绿色框不应出现在红色框之外或“渗出”红色框之外。问题是它包含在 PopUp 中,因此会溢出。我如何修改它(不删除 PopUp 控件)以便 PopUp 不会超出其包含的控件?
Simple, yet frustrating issue here...
I have a PopUp control.
It is contained in side a Grid, which has a Grid.Clip defined.
The PopUp is still visible outside the Grid's clipped area.
i.e.
<Grid Background="Red" Width="150" Height="150">
<Grid.Clip>
<RectangleGeometry Rect="0,0,150,150" />
</Grid.Clip>
<Popup IsOpen="True" Margin="100,100,0,0">
<Grid Background="Green" Width="150" Height="150" />
</Popup>
</Grid>
Ideally, the green box should not appear or "bleed" outside of the red box. The problem is that it is contained within a PopUp, and so it bleeds. How can I modify this (without removing the PopUp control) so that the PopUp does not bleed outside of it's containing control?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
弹出窗口的工作方式有所不同。它“忽略”其父级,并直接添加到应用程序的视觉根中。这就是它可以凌驾于一切之上的方式。
所以现在这取决于你想做什么。我认为popup不适合这种场景。
您可以尝试将弹出窗口剪辑到其模板中,但我觉得这不是您想要的。
Popup works differently. It "ignores" its parent and it is added directly into visual root of your app. This is how it can be on-top of everything.
So now it depends on what are you trying to do. I think popup is not suitable for this scenario.
You can try to clip the popup in its template, but I feel that's not what you want.