Marc Andreson
Marc Andreson

Reputation: 3495

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.

Upvotes: 0

Views: 143

Answers (1)

Phil
Phil

Reputation: 42991

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>

Upvotes: 2

Related Questions