设计Popup Window
设计一个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的更多相关文章
- jQuery Custom PopUp Window
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- 在指定控件位置弹出popup window
先看效果图 黄色的就是弹出的popup window 首先自定义一个view用来显示,文件名为layout_my_view.xml <?xml version="1.0" e ...
- 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 ...
- 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 ...
- 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 ...
- WDA基础十五:POPUP WINDOW
1.组件控制器定义属性: 2.实现popup方法: METHOD stock_popup . DATA: l_cmp_api TYPE REF TO if_wd_component, l_window ...
- python 利用tkinter模块设计出window窗口(搞笑版)
代码如下 from tkinter import * import tkinter from tkinter import messagebox #定义了一个函数,当关闭window窗口时将会弹出一个 ...
- [XAF] Keep the DetailView open in a popup window
public class ViewController1 : ViewController { ListViewProcessCurrentObjectController controller; p ...
- Popup window
function createLoadingDialog() { $("#loadingDialog").dialog({ autoOpen: false, closeOnEsca ...
随机推荐
- python 函数赋值
⾸先我们来理解下Python中的函数 def hi(name="yasoob"): return "hi " + name print(hi()) # outp ...
- c++ 查找容器中符合条件的元素,并返回iterator(find_if)
#include <iostream> // std::cout #include <algorithm> // std::find_if #include <vecto ...
- ubuntu-server14.04 网络配置
一.启动网卡 ubuntu server 安装后,ifconfig 发现只有一个lo 和一个p1p1 网卡, 先查看服务器网卡:ifconfig -a ,发现有lo ,p1p1,p2p1,p3p1,p ...
- Qt5_qtconfig
1.http://tieba.baidu.com/p/3225596765 QtConfig was removed in Qt5. If you want to force Qt5 to use a ...
- Spring AMQP 源码分析 06 - 手动消息确认
### 准备 ## 目标 了解 Spring AMQP 如何手动确认消息已成功消费 ## 前置知识 <Spring AMQP 源码分析 04 - MessageListener> ## 相 ...
- RabbitMQ入门_13_消息持久化
参考资料:https://www.rabbitmq.com/tutorials/tutorial-two-java.html 默认情况下,队列中的消息是不持久化的.如果 RabbitMQ 崩溃,队列中 ...
- stats.js随时查看fps
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- Unity 如何在打包的时候执行一些逻辑
1.如果想让unity在打包的过程中,执行一些逻辑,那么该如何做呢?代码如下: using UnityEditor; using UnityEditor.Build; using UnityEngin ...
- java中的static关键字 学习总结
使用static关键字修饰的变量和方法为静态变量.静态方法. 非静态方法可以访问静态变量/方法和非静态变量/方法,但静态方法只能访问静态变量/方法. 可以看到在静态方法中调用非静态变量和非静态方法时, ...
- English trip -- VC(情景课)10 A Get ready 预备课
Words dance 跳舞 exercise 运动:锻炼 fish 鱼 play basketball 打篮球 play cards 玩牌 swim 游泳 decorations 装饰品 ...