码迷,mamicode.com
首页 > 其他好文 > 详细

e.handled的用法

时间:2014-12-10 12:19:30      阅读:148      评论:0      收藏:0      [点我收藏+]

标签:blog   ar   sp   for   on   div   log   bs   ef   

        void gl_MouseLeftButtonDownCompleted(object sender, GraphicMouseButtonEventArgs e)
        {
            Graphic clickedGraphic = e.Graphic;
            if (clickedGraphic != null)
            {
                DZInfoWindow.Anchor = clickedGraphic.Geometry.Extent.GetCenter();
                DZInfoWindow.IsOpen = true;
                //Since a ContentTemplate is defined, Content will define the DataContext for the ContentTemplate
                DZInfoWindow.Content = clickedGraphic.Attributes;
                myMap.PanTo(clickedGraphic.Geometry);
            }
            e.Handled = true;
            return;
        }


        private void myMap_MouseClick(object sender, Map.MouseEventArgs e)
        {
            DZInfoWindow.IsOpen = false;
            
        }

  esri:map中有graphiclayer图层。点击graphiclayer中的graphic后,会触发graphiclayer的mousebuttondown事件,打开Infowindow。如果不设置e.handled=true。那么还会触发map中的mouseclick事件,导致infowindow打开后又关闭,设置了e.handled=true后,在graphicmousebuttondown后,事件就终结了,不会触发mapmouseclick事件。实现类似百度的打开、关闭信息窗口效果。

 

e.handled的用法

标签:blog   ar   sp   for   on   div   log   bs   ef   

原文地址:http://www.cnblogs.com/xlyg-14/p/4154990.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!