设计一个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. PHP生成缩略图的一个方法类(转)

    //使用如下类就可以生成图片缩略图 class resizeimage { //图片类型 var $type; //实际宽度 var $width; //实际高度 var $height; //改变后 ...

  2. python ros 订阅robot_pose获取机器人位置

    #!/usr/bin/env python import rospy import tf from tf.transformations import * from std_msgs.msg impo ...

  3. Qt数据库_资料

    1. QT笔记_数据库总结(一)-rojian-ChinaUnix博客.html http://blog.chinaunix.net/uid-28194872-id-3631462.html (里面有 ...

  4. Error updating database. Cause: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Truncated incorrect DOUBLE value: 'as3'

    执行更新时的出错信息 Whitelabel Error Page This application has no explicit mapping for /error, so you are see ...

  5. Flutter学习笔记(五)

    一.Container 是一个便利的Widget,它把通用的绘制.定位和Widget的大小结合了起来. Container会先用padding填充子Widget和border之间的空白,然后添加其他的 ...

  6. Codeforces 559B - Equivalent Strings

    559B - Equivalent Strings 思路:字符串处理,分治 不要用substr(),会超时 AC代码: #include<bits/stdc++.h> #include&l ...

  7. checklistbox的用法

    一般认为:foreach (object obj in checkedListBox1.SelectedItems)即可遍历选中的值.其实这里遍历的只是高亮的值并不是打勾的值.遍历打勾的值要用下面的代 ...

  8. php--------php库生成二维码和有logo的二维码

    php生成二维码和带有logo的二维码,上一篇博客讲的是js实现二维码:php--------使用js生成二维码. 今天写的这个小案例是使用php库生成二维码: 效果图:        使用了 php ...

  9. Educational Codeforces Round 47 (Rated for Div. 2)G. Allowed Letters 网络流

    题意:给你一个字符串,和每个位置可能的字符(没有就可以放任意字符)要求一个排列使得每个位置的字符在可能的字符中,求字典序最小的那个 题解:很容易判断有没有解,建6个点表示从a-f,和源点连边,容量为原 ...

  10. python 小练习 9

    还记得中学时候学过的杨辉三角吗?具体的定义这里不再描述,你可以参考以下的图形: 1 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 .............. 先 ...