设计一个Popup window, 在其中实现分享到Facebook 和Twitter 功能。

popup window 名称为 ShareView.xaml, 代码如下:

<phone:PhoneApplicationPage
x:Class="MVA.ShareView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
shell:SystemTray.IsVisible="False"> <!--LayoutRoot contains the root grid where all other page content is placed-->
<Grid x:Name="LayoutRoot" Background="#FF20422E"> <Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions> <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
<TextBlock x:Name="pageTitle" HorizontalAlignment="Center" Text="Share this Course" Margin="9,-1,0,0" Style="{StaticResource PhoneTextTitle1Style}" FontSize="50" /> </StackPanel>
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border Grid.Row="0" Grid.Column="0" Tap="Border_Tap_1" >
<Image Height="100" Width="100" Source="/Assets/Icon/facetitle.JPG" />
</Border>
<Border Grid.Row="0" Grid.Column="1" Tap="Border_Tap_2">
<Image Height="100" Width="100" Source="/Assets/Icon/twittertitle.JPG"/>
</Border>
<Button Content="Close Share" Grid.Row="1" Grid.ColumnSpan="2" Height="72" HorizontalAlignment="Left" Margin="120,152,0,0" Name="btnShowPopUp" VerticalAlignment="Top" Width="235" Click="btnShowPopUp_Click_1" />
</Grid>
</Grid> </phone:PhoneApplicationPage>

后台代码:

using System.Windows.Controls.Primitives;
using Microsoft.Phone.Tasks; public partial class ShareView : PhoneApplicationPage
{
public ShareView()
{
InitializeComponent();
} private void btnShowPopUp_Click_1(object sender, RoutedEventArgs e)
{
ClosePopup();
} private void ClosePopup()
{
Popup popupWindow = this.Parent as Popup;
popupWindow.IsOpen = false;
} private void Border_Tap_1(object sender, System.Windows.Input.GestureEventArgs e)
{
var item = CommonConfig.SelectedItem;
if (item != null)
{
string url=item.ID;
CommonConfig.FaceBookSharePath = url;
WebBrowserTask webTask = new WebBrowserTask();
webTask.Uri = new Uri(CommonConfig.FaceBookSharePath, UriKind.Absolute);
webTask.Show();
}
} private void Border_Tap_2(object sender, System.Windows.Input.GestureEventArgs e)
{
var item = CommonConfig.SelectedItem;
if (item != null)
{
string url = item.ID;
CommonConfig.TwitterSharePath = url;
WebBrowserTask webTask = new WebBrowserTask();
webTask.Uri = new Uri(CommonConfig.TwitterSharePath, UriKind.Absolute);
webTask.Show();
}
}
}

触发 Popup Window 的事件:

        private void TextBlock_Tap_2(object sender, System.Windows.Input.GestureEventArgs e)
{
Popup popupView;
popupView = new Popup(); popupView.Child = new ShareView();
popupView.IsOpen = true;
popupView.VerticalOffset = ;
popupView.HorizontalOffset = ;
}

参考:

http://www.mindfiresolutions.com/Display-Popup-Box-in-Windows-2108.php

设计Popup Window的更多相关文章

  1. jQuery Custom PopUp Window

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  2. 在指定控件位置弹出popup window

    先看效果图 黄色的就是弹出的popup window 首先自定义一个view用来显示,文件名为layout_my_view.xml <?xml version="1.0" e ...

  3. Pass value from child popup window to parent page window using JavaScript--reference

    Here Mudassar Ahmed Khan has explained how to pass value from child popup window to parent page wind ...

  4. Error when clicking other button after displaying Popup window(转)

    原文地址:Error when clicking other button after displaying Popup window Hi, I'm developing a custom page ...

  5. Add an Action that Displays a Pop-up Window 添加显示弹出窗口按钮

    In this lesson, you will learn how to create an Action that shows a pop-up window. This type of Acti ...

  6. WDA基础十五:POPUP WINDOW

    1.组件控制器定义属性: 2.实现popup方法: METHOD stock_popup . DATA: l_cmp_api TYPE REF TO if_wd_component, l_window ...

  7. python 利用tkinter模块设计出window窗口(搞笑版)

    代码如下 from tkinter import * import tkinter from tkinter import messagebox #定义了一个函数,当关闭window窗口时将会弹出一个 ...

  8. [XAF] Keep the DetailView open in a popup window

    public class ViewController1 : ViewController { ListViewProcessCurrentObjectController controller; p ...

  9. Popup window

    function createLoadingDialog() { $("#loadingDialog").dialog({ autoOpen: false, closeOnEsca ...

随机推荐

  1. html 画圆

    <html> <head> <script type = "text/javascript" src = "https://d3js.org ...

  2. Ubuntu14.04 ,libboost_filesystem.so.1.54.0: cannot open shared object file: No such file or directory

    macname@ubuntu:/opt$ roslaunch blarospack : error : cannot open shared object file: No such file or ...

  3. 关于nohup 和 &的使用

    nohup  是 no hang up 的缩写,意思是不挂断运行,一直运行下去,永久运行下去,但是注意并没有后台运行的功能 & 是在后台运行的意思 单独使用一个命令,还不能在终端关闭的时候,让 ...

  4. Python day17 模块介绍1(time,random)

    module模块和包的介绍(略掉了) 常用模块 # time模块 import time print(time.time())#时间戳,在1970年开始到现在一共多少秒 print(time.gmti ...

  5. RabbitMQ入门_04_Exchange & Binding

    如果你比较细心,你会发现 HelloWorld 例子中的 Sender 只申明了一个 hello 队列,然后就开始向默认 Exchange 发送路由键为 hello 的消息.按照之前 AMQP 基本概 ...

  6. Unity搭建简单的图片服务器

    具体要实现的目标是:将图片手动拷贝到服务器,然后在Unity中点击按钮将服务器中的图片加载到Unity中. 首先简答解释下 WAMP(Windows + Apache + Mysql + PHP),一 ...

  7. WCF配置后支持通过URL进行http方式调用

    最近遇到一个小型项目,主要就是通过手机写入NFC信息,思考许久后决定就写一个简单的CS程序来搞定这个问题,可是当涉及到手机和PC通信的时候首先考虑到的就是IIS,同时因为数据库是SQLite,思前想后 ...

  8. 20170517xlVBA添加数据透视表

    Sub AddPovitTable() 'Constance Const DATA_SHEET As String = "Advanced Filter" Const DATA_A ...

  9. mysql查询出来的某一列合并成一个字段

    查询所有用户及角色,一个用户会有多个角色 select u.*,sr.* from users u left join sys_user_role sur on sur.userCode=u.id l ...

  10. IE6不兼容postion:fixed已解决

    将要设置postion:fixed的元素的css中添加以下代码: //如果想要是头部悬停,则以下代码即可. .customService{        position: fixed;bottom: ...