开发者

PopUp in Silverlight is not being clipped by container control

开发者 https://www.devze.com 2023-02-17 16:26 出处:网络
Simple, yet frustrating issue here... I have a PopUp control. It is contained in side a Grid, which has a Grid.Clip defined.

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="G开发者_高级运维reen" 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消