Windows Phone 7 多点触摸编程

一、基本的程序结构

一个需要响应多点触控的 Silverlight 应用程序必须将一个处理程序连接到静态 Touch.FrameReported 事件:

Touch.FrameReported += OnTouchFrameReported;
FrameReported 事件是静态 Touch 类的唯一公共成员。处理程序如下所示:

void OnTouchFrameReported(
object sender, TouchFrameEventArgs args) {
...
}
您可以在应用程序中安装多个 Touch.FrameReported 事件处理程序,所有这些事件处理程序都会报告应用程序中任何位置的所有触控事件。

二、事件传入参数TouchFrameEventArgs

TouchFrameEventArgs 有一个名为 TimeStamp 的公共属性(我还没有机会使用)和三个重要的公共方法:

TouchPoint GetPrimaryTouchPoint(UIElement relativeTo)
TouchPointCollection GetTouchPoints(UIElement relativeTo)
void SuspendMousePromotionUntilTouchUp()
GetPrimaryTouchPoint 或 GetTouchPoints 的参数仅用于报告 TouchPoint 对象的位置信息。您可以将空值用于此参数,位置信息相对于整个 Silverlight 应用程序的左上角。

多点触控支持多个手指同时触摸屏幕,触摸屏幕的每个手指(数量存在上限,当前通常为两个)都是一个触摸点。主要触摸点是指在没有其他手指触摸屏幕并且未按下鼠标按钮时触摸屏幕的手指。用一个手指触摸屏幕。这是主要触摸点。

在第一个手指仍触摸着屏幕时,将第二个手指放在屏幕上。很显然,第二手指不是主要触摸点。但现在仍将第二个手指放在屏幕上,抬起第一个手指,然后再将其放回到屏幕上。这是主要触摸点吗?不,都不是。仅当没有其他手指触摸屏幕时,才会出现主要触摸点。

在实际的多点触控应用程序中,您应该注意不要依赖主要触摸点,因为用户通常不会重视第一次触摸的特定意义。仅为实际触摸屏幕的手指激发事件。对非常接近屏幕但并未触摸屏幕的手指,不会进行悬停检测。

基于一个触摸点或多个触摸点激发一个特殊的 Touch.FrameReported 事件。从 GetTouchPoints 方法返回的 TouchPointCollection 包含与特定事件关联的所有触摸点。从 GetPrimaryTouchPoint 返回的 TouchPoint 始终是一个主要触摸点。如果没有与该特定事件关联的主要触摸点,GetPrimaryTouchPoint 将返回 null。即使从 GetPrimaryTouchPoint 返回的 TouchPoint 不是 null,它也不会与从 GetTouchPoints 返回的其中一个 TouchPoint 对象是相同对象,但在传递给这些方法的参数相同时所有属性将相同。

TouchPoint 类定义以下四个只读属性,这些属性都由依赖属性支持:

Action 属性,类型为 TouchAction(一个具有 Down、Move 和 Up 成员的枚举)。
Position 属性,类型为 Point,它相对于作为参数传递给 GetPrimaryTouchPoint 或 GetTouchPoints 方法的元素(或相对于参数为 null 的应用程序的左上角)。
Size 属性,类型为 Size。

TouchDevice 属性,类型为 TouchDevice。

TouchDevice 对象具有两个也由依赖属性支持的只读属性:

DirectlyOver 属性,类型为 DirectlyOver(手指下最上面的元素)。
Id 属性,类型为 int。
DirectlyOver 不必是传递给 GetPrimaryTouchPoint 或 GetTouchPoints 的元素的子项。如果手指在 Silverlight 应用程序内(由 Silverlight 插件对象的尺寸定义),但不在可点击测试控件覆盖的范围内,则此属性可以为空。(具有空背景刷的面板不可点击测试。)

若要在多个手指之间区分,ID 属性至关重要。在特定手指触摸屏幕时,与该手指关联的一系列特定事件总是以 Down 操作开始,接着是 Move 事件,最后是 Up 事件。所有这些事件都将与相同的 ID 关联。(但不要以为主要触摸点的 ID 值将为 0 或 1。)

大多数重要的多点触控代码都会使用 Dictionary 集合,其中 TouchDevice 的 ID 属性是字典键。这是跨事件存储特定手指信息的方式。

三、涂鸦板例子

涂鸦板例子 综合运用ApplicationBar菜单、多点触摸和IsolatedStorageFile本地存储

 

  

xaml

 
 
  1. View Code   
  2.  
  3. <phone:PhoneApplicationPage   
  4.     x:Class="Jot.MainPage" 
  5.     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  6.     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
  7.     xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" 
  8.     xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" 
  9.     xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
  10.     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
  11.     FontFamily="{StaticResource PhoneFontFamilyNormal}" 
  12.     FontSize="{StaticResource PhoneFontSizeNormal}" 
  13.     Foreground="{StaticResource PhoneForegroundBrush}" 
  14.     SupportedOrientations="Portrait" Orientation="Portrait" 
  15.     mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="768" 
  16.     shell:SystemTray.IsVisible="True"> 
  17.  
  18.     <!--LayoutRoot contains the root grid where all other page content is placed--> 
  19.     <Grid x:Name="LayoutRoot" Background="Transparent"> 
  20.         <Grid.RowDefinitions> 
  21.             <RowDefinition Height="Auto"/> 
  22.             <RowDefinition Height="*"/> 
  23.         </Grid.RowDefinitions> 
  24.  
  25.         <!--TitlePanel contains the name of the application and page title--> 
  26.         <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28" 
  27.                     Orientation="Horizontal"> 
  28.             <TextBlock x:Name="ApplicationTitle" Text="JOT"   
  29.                        Style="{StaticResource PhoneTextNormalStyle}" 
  30.                        Margin="12 0 0 0" /> 
  31.             <TextBlock Name="pageInfoTitle"   
  32.                        Style="{StaticResource PhoneTextNormalStyle}" 
  33.                        Margin="0" /> 
  34.         </StackPanel> 
  35.  
  36.         <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> 
  37.             <InkPresenter Name="inkPresenter" /> 
  38.         </Grid> 
  39.     </Grid> 
  40.       
  41.     <phone:PhoneApplicationPage.ApplicationBar> 
  42.         <shell:ApplicationBar> 
  43.             <!--工具条--> 
  44.             <shell:ApplicationBarIconButton x:Name="appbarAddButton"   
  45.                                             IconUri="/Images/appbar.add.rest.png"   
  46.                                             Text="add page"   
  47.                                             Click="OnAppbarAddClick" /> 
  48.               
  49.             <shell:ApplicationBarIconButton x:Name="appbarLastButton"   
  50.                                             IconUri="/Images/appbar.back.rest.png"   
  51.                                             Text="last page"   
  52.                                             Click="OnAppbarLastClick" /> 
  53.               
  54.             <shell:ApplicationBarIconButton x:Name="appbarNextButton"   
  55.                                             IconUri="/Images/appbar.next.rest.png"   
  56.                                             Text="next page"   
  57.                                             Click="OnAppbarNextClick" /> 
  58.               
  59.             <shell:ApplicationBarIconButton x:Name="appbarDeleteButton"   
  60.                                             IconUri="/Images/appbar.delete.rest.png"   
  61.                                             Text="delete page"   
  62.                                             Click="OnAppbarDeleteClick" /> 
  63.             <!--菜单栏--> 
  64.             <shell:ApplicationBar.MenuItems> 
  65.                 <shell:ApplicationBarMenuItem Text="swap colors"   
  66.                                               Click="OnAppbarSwapColorsClick" /> 
  67.                   
  68.                 <shell:ApplicationBarMenuItem Text="light stroke width" 
  69.                                               Click="OnAppbarSetStrokeWidthClick" /> 
  70.                   
  71.                 <shell:ApplicationBarMenuItem Text="medium stroke width" 
  72.                                               Click="OnAppbarSetStrokeWidthClick" /> 
  73.                   
  74.                 <shell:ApplicationBarMenuItem Text="heavy stroke width" 
  75.                                               Click="OnAppbarSetStrokeWidthClick" /> 
  76.             </shell:ApplicationBar.MenuItems> 
  77.         </shell:ApplicationBar> 
  78.     </phone:PhoneApplicationPage.ApplicationBar> 
  79.       
  80. </phone:PhoneApplicationPage> 

 

cs

 
 
  1. View Code   
  2.  
  3. using System;  
  4. using System.Collections.Generic;  
  5. using System.Windows;  
  6. using System.Windows.Ink;  
  7. using System.Windows.Input;  
  8. using System.Windows.Media;  
  9. using Microsoft.Phone.Controls;  
  10. using Microsoft.Phone.Shell;  
  11.  
  12. namespace Jot  
  13. {  
  14.     public partial class MainPage : PhoneApplicationPage  
  15.     {  
  16.         JotAppSettings appSettings = (Application.Current as App).AppSettings;  
  17.         Dictionary<int, Stroke> activeStrokes = new Dictionary<int, Stroke>();  
  18.  
  19.         public MainPage()  
  20.         {  
  21.             InitializeComponent();  
  22.  
  23.             inkPresenter.Strokes = appSettings.StrokeCollections[appSettings.PageNumber];  
  24.             inkPresenter.Background = new SolidColorBrush(appSettings.Background);  
  25.  
  26.             // Re-assign ApplicationBar button names  
  27.             appbarLastButton = this.ApplicationBar.Buttons[1] as ApplicationBarIconButton;  
  28.             appbarNextButton = this.ApplicationBar.Buttons[2] as ApplicationBarIconButton;  
  29.             appbarDeleteButton = this.ApplicationBar.Buttons[3] as ApplicationBarIconButton;  
  30.  
  31.             TitleAndAppbarUpdate();  
  32.  
  33.             Touch.FrameReported += OnTouchFrameReported;  
  34.             //一个需要响应多点触控的 Silverlight 应用程序必须将一个处理程序连接到静态 Touch.FrameReported 事件  
  35.         }  
  36.  
  37.         //处理多点触摸事件  
  38.         void OnTouchFrameReported(object sender, TouchFrameEventArgs args)  
  39.         {  
  40.             TouchPoint primaryTouchPoint = args.GetPrimaryTouchPoint(null);  
  41.  
  42.             if (primaryTouchPoint != null && primaryTouchPoint.Action == TouchAction.Down)  
  43.                 args.SuspendMousePromotionUntilTouchUp();  
  44.             /*  
  45.              * foreach 循环枚举从 GetTouchPoints 返回的 TouchPointCollection 的 TouchPoint 成员。  
  46.              * (您会希望多点触控感知 Silverlight 程序能处理多个手指,但您不会希望它在检测到太多手指时出现故障!)ID 将添加到 Down 事件的字典中,然后从 Up 事件的字典中删除。  
  47.              * */  
  48.             TouchPointCollection touchPoints = args.GetTouchPoints(inkPresenter);  
  49.  
  50.             foreach (TouchPoint touchPoint in touchPoints)  
  51.             {  
  52.                 Point pt = touchPoint.Position;  
  53.                 int id = touchPoint.TouchDevice.Id;  
  54.  
  55.                 switch (touchPoint.Action)  
  56.                 {  
  57.                     case TouchAction.Down:  
  58.                         Stroke stroke = new Stroke();  
  59.                         stroke.DrawingAttributes.Color = appSettings.Foreground;  
  60.                         stroke.DrawingAttributes.Height = appSettings.StrokeWidth;  
  61.                         stroke.DrawingAttributes.Width = appSettings.StrokeWidth;  
  62.                         stroke.StylusPoints.Add(new StylusPoint(pt.X, pt.Y));  
  63.  
  64.                         inkPresenter.Strokes.Add(stroke);  
  65.                         activeStrokes.Add(id, stroke);  
  66.                         break;  
  67.  
  68.                     case TouchAction.Move:  
  69.                         activeStrokes[id].StylusPoints.Add(new StylusPoint(pt.X, pt.Y));  
  70.                         break;  
  71.  
  72.                     case TouchAction.Up:  
  73.                         activeStrokes[id].StylusPoints.Add(new StylusPoint(pt.X, pt.Y));  
  74.                         activeStrokes.Remove(id);  
  75.  
  76.                         TitleAndAppbarUpdate();  
  77.                         break;  
  78.                 }  
  79.             }  
  80.         }  
  81.  
  82.         //新增一个页面  
  83.         void OnAppbarAddClick(object sender, EventArgs args)  
  84.         {  
  85.             StrokeCollection strokes = new StrokeCollection();  
  86.             appSettings.PageNumber += 1;  
  87.             appSettings.StrokeCollections.Insert(appSettings.PageNumber, strokes);  
  88.             inkPresenter.Strokes = strokes;  
  89.             TitleAndAppbarUpdate();  
  90.         }  
  91.         //上一个页面  
  92.         void OnAppbarLastClick(object sender, EventArgs args)  
  93.         {  
  94.             appSettings.PageNumber -1;  
  95.             inkPresenter.Strokes = appSettings.StrokeCollections[appSettings.PageNumber];  
  96.             TitleAndAppbarUpdate();  
  97.         }  
  98.         //下一个页面  
  99.         void OnAppbarNextClick(object sender, EventArgs args)  
  100.         {  
  101.             appSettings.PageNumber += 1;  
  102.             inkPresenter.Strokes = appSettings.StrokeCollections[appSettings.PageNumber];  
  103.             TitleAndAppbarUpdate();  
  104.         }  
  105.         //删除当前的页面  
  106.         void OnAppbarDeleteClick(object sender, EventArgs args)  
  107.         {  
  108.             MessageBoxResult result = MessageBox.Show("Delete this page?", "Jot",   
  109.                                                        MessageBoxButton.OKCancel);  
  110.  
  111.             if (result == MessageBoxResult.OK)  
  112.             {  
  113.                 if (appSettings.StrokeCollections.Count == 1)  
  114.                 {  
  115.                     appSettings.StrokeCollections[0].Clear();  
  116.                 }  
  117.                 else  
  118.                 {  
  119.                     appSettings.StrokeCollections.RemoveAt(appSettings.PageNumber);  
  120.  
  121.                     if (appSettings.PageNumber == appSettings.StrokeCollections.Count)  
  122.                         appSettings.PageNumber -1;  
  123.  
  124.                     inkPresenter.Strokes = appSettings.StrokeCollections[appSettings.PageNumber];  
  125.                 }  
  126.                 TitleAndAppbarUpdate();  
  127.             }  
  128.         }  
  129.         //设置画笔背景颜色  
  130.         void OnAppbarSwapColorsClick(object sender, EventArgs args)  
  131.         {  
  132.             Color foreground = appSettings.Background;  
  133.             appSettingsappSettings.Background = appSettings.Foreground;  
  134.             appSettings.Foreground = foreground;  
  135.             inkPresenter.Background = new SolidColorBrush(appSettings.Background);  
  136.  
  137.             foreach (StrokeCollection strokeCollection in appSettings.StrokeCollections)  
  138.                 foreach (Stroke stroke in strokeCollection)  
  139.                     stroke.DrawingAttributes.Color = appSettings.Foreground;  
  140.         }  
  141.         //设置画笔的粗细  
  142.         void OnAppbarSetStrokeWidthClick(object sender, EventArgs args)  
  143.         {  
  144.             ApplicationBarMenuItem item = sender as ApplicationBarMenuItem;  
  145.  
  146.             if (item.Text.StartsWith("light"))  
  147.                 appSettings.StrokeWidth = 1;  
  148.  
  149.             else if (item.Text.StartsWith("medium"))  
  150.                 appSettings.StrokeWidth = 3;  
  151.  
  152.             else if (item.Text.StartsWith("heavy"))  
  153.                 appSettings.StrokeWidth = 5;  
  154.         }  
  155.  
  156.         void TitleAndAppbarUpdate()  
  157.         {  
  158.             pageInfoTitle.Text = String.Format(" - PAGE {0} OF {1}",   
  159.                                                appSettings.PageNumber + 1,   
  160.                                                appSettings.StrokeCollections.Count);  
  161.  
  162.             appbarLastButton.IsEnabled = appSettings.PageNumber > 0;  
  163.             appbarNextButton.IsEnabled =   
  164.                         appSettings.PageNumber < appSettings.StrokeCollections.Count - 1;  
  165.             appbarDeleteButton.IsEnabled = (appSettings.StrokeCollections.Count > 1) ||  
  166.                                            (appSettings.StrokeCollections[0].Count > 0);  
  167.         }  
  168.     }  

 

本地存储功能封装的类

 

 
 
  1. View Code   
  2.  
  3. using System;  
  4. using System.Collections.Generic;  
  5. using System.IO;  
  6. using System.IO.IsolatedStorage;  
  7. using System.Windows;  
  8. using System.Windows.Ink;  
  9. using System.Windows.Media;  
  10. using System.Xml.Serialization;  
  11.  
  12. namespace Jot  
  13. {  
  14.     public class JotAppSettings  
  15.     {  
  16.         public JotAppSettings()  
  17.         {  
  18.             this.PageNumber = 0;  
  19.             this.Foreground = (Color)Application.Current.Resources["PhoneForegroundColor"];  
  20.             this.Background = (Color)Application.Current.Resources["PhoneBackgroundColor"];  
  21.             this.StrokeWidth = 3;  
  22.         }  
  23.  
  24.         // Public properties -- the actual application settins  
  25.         public List<StrokeCollection> StrokeCollections { get; set; }  
  26.         public int PageNumber { set; get; }  
  27.         public Color Foreground { set; get; }  
  28.         public Color Background { set; get; }  
  29.         public int StrokeWidth { set; get; }  
  30.  
  31.         public static JotAppSettings Load()  
  32.         {  
  33.             JotAppSettings settings;  
  34.             IsolatedStorageFile iso = IsolatedStorageFile.GetUserStoreForApplication();  
  35.  
  36.             if (iso.FileExists("settings.xml"))  
  37.             {  
  38.                 IsolatedStorageFileStream stream = iso.OpenFile("settings.xml", FileMode.Open);  
  39.                 StreamReader reader = new StreamReader(stream);  
  40.  
  41.                 XmlSerializer ser = new XmlSerializer(typeof(JotAppSettings));  
  42.                 settings = ser.Deserialize(reader) as JotAppSettings;  
  43.  
  44.                 reader.Close();  
  45.             }  
  46.             else  
  47.             {  
  48.                 // Create and initialize new JotAppSettings object  
  49.                 settings = new JotAppSettings();  
  50.                 settings.StrokeCollections = new List<StrokeCollection>();  
  51.                 settings.StrokeCollections.Add(new StrokeCollection());  
  52.             }  
  53.  
  54.             iso.Dispose();  
  55.             return settings;  
  56.         }  
  57.  
  58.         public void Save()  
  59.         {  
  60.             IsolatedStorageFile iso = IsolatedStorageFile.GetUserStoreForApplication();  
  61.             IsolatedStorageFileStream stream = iso.CreateFile("settings.xml");  
  62.             StreamWriter writer = new StreamWriter(stream);  
  63.  
  64.             XmlSerializer ser = new XmlSerializer(typeof(JotAppSettings));  
  65.             ser.Serialize(writer, this);  
  66.  
  67.             writer.Close();  
  68.             iso.Dispose();  
  69.         }  
  70.     }  

app.xaml

 

 
 
  1. View Code   
  2.  
  3. <Application   
  4.     x:Class="Jot.App" 
  5.     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"         
  6.     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
  7.     xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" 
  8.     xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"> 
  9.  
  10.     <!--Application Resources--> 
  11.     <Application.Resources> 
  12.     </Application.Resources> 
  13.  
  14.     <Application.ApplicationLifetimeObjects> 
  15.         <!--Required object that handles lifetime events for the application--> 
  16.         <shell:PhoneApplicationService   
  17.             Launching="Application_Launching" Closing="Application_Closing"   
  18.             Activated="Application_Activated" Deactivated="Application_Deactivated"/> 
  19.     </Application.ApplicationLifetimeObjects> 
  20.  
  21. </Application> 

app.xaml.cs

 

 
 
  1. View Code   
  2.  
  3. using System;  
  4. using System.Windows;  
  5. using System.Windows.Navigation;  
  6. using Microsoft.Phone.Controls;  
  7. using Microsoft.Phone.Shell;  
  8.  
  9. namespace Jot  
  10. {  
  11.     public partial class App : Application  
  12.     {  
  13.         // Application Settings  
  14.         public JotAppSettings AppSettings { set; get; }  
  15.  
  16.         // Easy access to the root frame  
  17.         public PhoneApplicationFrame RootFrame { get; private set; }  
  18.  
  19.         // Constructor  
  20.         public App()  
  21.         {  
  22.             // Global handler for uncaught exceptions.   
  23.             // Note that exceptions thrown by ApplicationBarItem.Click will not get caught here.  
  24.             UnhandledException += Application_UnhandledException;  
  25.  
  26.             // Standard Silverlight initialization  
  27.             InitializeComponent();  
  28.  
  29.             // Phone-specific initialization  
  30.             InitializePhoneApplication();  
  31.         }  
  32.  
  33.         // Code to execute when the application is launching (eg, from Start)  
  34.         // This code will not execute when the application is reactivated  
  35.         private void Application_Launching(object sender, LaunchingEventArgs e)  
  36.         {  
  37.             AppSettings = JotAppSettings.Load();  
  38.         }  
  39.  
  40.         // Code to execute when the application is activated (brought to foreground)  
  41.         // This code will not execute when the application is first launched  
  42.         private void Application_Activated(object sender, ActivatedEventArgs e)  
  43.         {  
  44.             AppSettings = JotAppSettings.Load();  
  45.         }  
  46.  
  47.         // Code to execute when the application is deactivated (sent to background)  
  48.         // This code will not execute when the application is closing  
  49.         private void Application_Deactivated(object sender, DeactivatedEventArgs e)  
  50.         {  
  51.             AppSettings.Save();  
  52.         }  
  53.  
  54.         // Code to execute when the application is closing (eg, user hit Back)  
  55.         // This code will not execute when the application is deactivated  
  56.         private void Application_Closing(object sender, ClosingEventArgs e)  
  57.         {  
  58.             AppSettings.Save();  
  59.         }  
  60.  
  61.         // Code to execute if a navigation fails  
  62.         void RootFrame_NavigationFailed(object sender, NavigationFailedEventArgs e)  
  63.         {  
  64.             if (System.Diagnostics.Debugger.IsAttached)  
  65.             {  
  66.                 // A navigation has failed; break into the debugger  
  67.                 System.Diagnostics.Debugger.Break();  
  68.             }  
  69.         }  
  70.  
  71.         // Code to execute on Unhandled Exceptions  
  72.         private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)  
  73.         {  
  74.             if (System.Diagnostics.Debugger.IsAttached)  
  75.             {  
  76.                 // An unhandled exception has occurred; break into the debugger  
  77.                 System.Diagnostics.Debugger.Break();  
  78.             }  
  79.         }  
  80.  
  81.         #region Phone application initialization  
  82.  
  83.         // Avoid double-initialization  
  84.         private bool phoneApplicationInitialized = false;  
  85.  
  86.         // Do not add any additional code to this method  
  87.         private void InitializePhoneApplication()  
  88.         {  
  89.             if (phoneApplicationInitialized)  
  90.                 return;  
  91.  
  92.             // Create the frame but don't set it as RootVisual yet; this allows the splash  
  93.             // screen to remain active until the application is ready to render.  
  94.             RootFrame = new PhoneApplicationFrame();  
  95.             RootFrame.Navigated += CompleteInitializePhoneApplication;  
  96.  
  97.             // Handle navigation failures  
  98.             RootFrame.NavigationFailed += RootFrame_NavigationFailed;  
  99.  
  100.             // Ensure we don't initialize again  
  101.             phoneApplicationInitialized = true;  
  102.         }  
  103.  
  104.         // Do not add any additional code to this method  
  105.         private void CompleteInitializePhoneApplication(object sender, NavigationEventArgs e)  
  106.         {  
  107.             // Set the root visual to allow the application to render  
  108.             if (RootVisual != RootFrame)  
  109.                 RootVisual = RootFrame;  
  110.  
  111.             // Remove this handler since it is no longer needed  
  112.             RootFrame.Navigated -CompleteInitializePhoneApplication;  
  113.         }  
  114.  
  115.         #endregion  
  116.     }  

 

本文转自linzheng 51CTO博客,原文链接:http://blog.51cto.com/linzheng/1079156



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值