设计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 ...
随机推荐
- shell 截取字符串
vvar='{"floor":2,"hotelid":"3433bbb"}' #vvar='{"hotelid":&qu ...
- Python day8常用格式化format类2
format常用格式化 tp1="i am {},age {},{}".format('LittlePage',18,'boy') tp2="i am {},age {} ...
- 【转】float类型在内存中的表示
http://www.cnblogs.com/onedime/archive/2012/11/19/2778130.html http://blog.csdn.net/adream307/articl ...
- C# Interface中的属性
只能写get,和set,到具体类实现的时候才确定get的是哪个字段的值,set的是哪个字段的值.
- 拓扑排序 Topological Sort
2018-05-02 16:26:07 在计算机科学领域,有向图的拓扑排序或拓扑排序是其顶点的线性排序,使得对于从顶点u到顶点v的每个有向边uv,u在排序中都在v前.例如,图形的顶点可以表示要执行的任 ...
- import 与 import static
原文链接:https://www.geeksforgeeks.org/static-import-java/ java中的静态引用 直接解释 一般引入类的方式:import java.lang.Mat ...
- 基因家族收缩和扩张分析 & Selective loss pathway & 泛基因组
套路 这通常就是基因组组装后的必做分析,通过比较基因组学的手段进行分析,可以知道所研究物种在进化过程中哪些核心基因家族发生了变化,从而导致了其特殊的适应性机制的形成. 参考: Extremotoler ...
- win10 WiFi 密码查询 命令
如果你笔记本有WiFi,正好你系统又是Win10 那么... netsh wlan show profile * key=clear
- 013 - 关于GC root: Native Stack | MAT分析
Question: I have some third library code that I run and after some time I run into OutOfMemoryEr ...
- Lunar New Year and Red Envelopes CodeForces - 1106E (dp)
大意: 总共$n$的时间, $k$个红包, 红包$i$只能在时间$[s_i,t_i]$范围内拿, 并且拿完后时间跳到$d_i+1$,Bob采用贪心策略,每个时间点若有红包能取则取钱数$w_i$最大的, ...