• 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事件

  • 相关阅读:
    javascript实现优先队列
    javascript中的队列结构
    mysql及php命名规范
    javascript使用栈结构将中缀表达式转换为后缀表达式并计算值
    【转】感知哈希算法——找出相似的图片
    重新注册iis的.NET Framework版本
    Extjs GridPanel用法详解
    Extjs Window用法详解
    Extjs Form用法详解(适用于Extjs5)
    Extjs MVC开发模式详解
  • 原文地址:https://www.cnblogs.com/gisbeginner/p/2521585.html
Copyright © 2020-2023  润新知