设计一个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. C++:为什么unique_ptr的Deleter是模板类型参数,而shared_ptr的Deleter不是?

    为什么unique_ptr的Deleter是模板类型参数,而shared_ptr的Deleter不是? template <class T, class D = default_delete&l ...

  2. 机器学习 MLIA学习笔记(一)

    监督学习(supervised learning):叫监督学习的原因是因为我们告诉了算法,我们想要预测什么.所谓监督,其实就是我们的意愿是否能直接作用于预测结果.典型代表:分类(classificat ...

  3. LookupError: Couldn't find path to unrar library.

    LookupError: Couldn't find path to unrar library. 意思是找不到 unrar library的路径,这里我们就需要去下载这个unrar library, ...

  4. Python中通过csv的writerow输出的内容有多余的空行

    第一种方法 如下生成的csv文件会有多个空行 import csv #python2可以用file替代open with open("test.csv","w" ...

  5. RabbitMQ入门_07_Fanout 与 Topic

    A. 用广播的方式实现发布订阅 参考资料:https://www.rabbitmq.com/tutorials/tutorial-three-java.html Fanout 类型的 Exchange ...

  6. ninja install error

    ninja install ...... CMake Error at cmake_install.cmake:36 (FILE):  file INSTALL cannot find  " ...

  7. angular5 组件之间监听传值变化

    http://www.cnblogs.com/SLchuck/p/5904000.html https://i.cnblogs.com/EditPosts.aspx?postid=7995179&am ...

  8. js 变量声明 (var使用与不使用的区别)

    js 变量声明 (var使用与不使用的区别) 一.总结 一句话总结:不使用var声明变量的时候,变量是全局对象(window对象)属性,在全局中使用var声明变量是全局变量 var 全局变量 局部变量 ...

  9. [Java学习] Java方法重载

    在Java中,同一个类中的多个方法可以有相同的名字,只要它们的参数列表不同就可以,这被称为方法重载(method overloading). 参数列表又叫参数签名,包括参数的类型.参数的个数和参数的顺 ...

  10. 20170624xlVBA正则分割分类汇总

    Sub RegExpSubtotal() '声明变量 Dim Regex As Object '正则对象 Dim Dic As Object '字典对象 Dim Key As String '关键字 ...