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

  • 相关阅读:
    JAVA垃圾收集器
    ora-12154
    获取IE浏览器关闭事件
    ajax 页面请求后,jsp页面定位
    poi 导出excel 异常处理方式--曲线救国法
    如何设计出高可用的分布式架构
    Java知识点整理(二)
    spring cloud & dubbo
    Spring Autowired原理
    如何更好的使用JAVA线程池
  • 原文地址:https://www.cnblogs.com/gisbeginner/p/2521585.html
Copyright © 2011-2022 走看看