在弹出的Windows Phone 8 [英] Popup in windows phone 8

查看:159
本文介绍了在弹出的Windows Phone 8的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要显示与媒体元素的弹出作为一个控制。
当用户点击该按钮,然后我必须表明这个弹出。而当用户点击该设备,然后在弹出的应关闭的后退按钮。

I want to show a popup with media element as one control. When user clicks on the button, then I have to show this popup. And when user clicks on the back button of the device then the popup should be closed.

请帮我如何做到这一点的Windows Phone 8应用程序。

Please help me how to do this in windows phone 8 application.

推荐答案

弹出与MediaElement的(视图的PhoneApplicationPage 的名称)

<Popup
    x:Name="popup">

    <Grid
        Background="{StaticResource PhoneChromeBrush}"
        Height="{Binding Path=ActualHeight, ElementName=view}"
        Width="{Binding Path=ActualWidth, ElementName=view}">

        <MediaElement />

    </Grid>

</Popup>



应用程序栏

<phone:PhoneApplicationPage.ApplicationBar>
    <shell:ApplicationBar>

        <shell:ApplicationBarIconButton
            Click="ShowPopup"
            IconUri="/Icons/show.png"
            Text="show" />

    </shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>



后面的代码

protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
{
    if (this.popup.IsOpen)
    {
        this.popup.IsOpen = false; 
        e.Cancel = true;
    }

    base.OnBackKeyPress(e);
}


private void ShowPopup(object sender, EventArgs e)
{
    this.popup.IsOpen = true;
}

这篇关于在弹出的Windows Phone 8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆