zoukankan      html  css  js  c++  java
  • PhoneApplicationPage 之观察 触摸事件 GIS

    在PhoneApplicationPage上点击触摸任意位置  或者其子控件 都会触发OnManipulationStarted这个事件 ,可以通过重写这个事件来改变触发的响应,OnManipulationStarted这个事件的参数args 可以获得 触发的原始控件

    namespace SilverlightTapHello2
    {
        public partial class MainPage : PhoneApplicationPage
        {
            Random rand = new Random();
            Brush originalBrush;

            public MainPage()
            {
                InitializeComponent();
                originalBrush = txtblk.Foreground;
            }

            protected override void OnManipulationStarted(ManipulationStartedEventArgs args)
            {
                if (args.OriginalSource == txtblk)
                {
                    txtblk.Foreground = new SolidColorBrush(
                                Color.FromArgb(255, (byte)rand.Next(256),
                                                    (byte)rand.Next(256),
                                                    (byte)rand.Next(256)));
                }
                else
                {
                    txtblk.Foreground = originalBrush;
                }

                args.Complete();
                base.OnManipulationStarted(args);
            }
        }
    }

    如果PhoneApplicationPage上的子控件定义了OnManipulationStarted这个事件  ,触摸子控件的时候就不会触发PhoneApplicationPage上(前提是args.Handled = true;)的触摸事件了,子控件没有定义的话 还是会触发PhoneApplicationPage上的OnManipulationStarted事件

  • 相关阅读:
    [原]three.js 地形法向量生成
    C# 创建XML文档
    <转载>在C#中操作XML(基础操作)
    <转载>Visual C#.NetSocket篇
    <转载>批处理重定向中的秘密
    <转载>最基本的Socket编程C#版
    <转载>在.NET中运行外部程序的3种方法
    <转载>修改Win7远程桌面端口
    <转载>Visual C#.NetTCP篇
    <转载>C#中的委托和事件(续)
  • 原文地址:https://www.cnblogs.com/gisbeginner/p/2521585.html
Copyright © 2011-2022 走看看