简体   繁体   中英

Windows phone layer

How can I create the effect similar to Windows Phone's MessageBox, where the message gets displayed on a new layer with transparent background, so that the windows becomes modal? My layout is created out of Grid, so I do not know how to add any content over it. Please help.

It's easy to overlay one set of content with another in WPF. Try changing the visibility of the border below, for a simple message box effect. You would of course bind Visibility to your view model, or set it in code behind.

<Grid>
    <Grid>
        <!-- All your layout here -->
    </Grid>
    <Border Height="100" Width="100" Background="Azure" Visibility="Hidden">
        <TextBlock Text="Hi there" HorizontalAlignment="Center" VerticalAlignment="Center"/>
    </Border>
</Grid>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM