Пример #1
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            if (mousePosition.HasValue)
            {
                var           position = e.GetPosition(ParentMap);
                MovedLocation ml       = this.DataContext as MovedLocation;
                if (ml != null)
                {
                    Location CurrentLocation = ParentMap.ViewportPointToLocation(position);
                    TemplatedParent.SetValue(MapPanel.LocationProperty, CurrentLocation);
                    ml.Latitude  = CurrentLocation.Latitude;
                    ml.Longitude = CurrentLocation.Longitude;
                    ml.Update();
                }
                else
                {
                    if (ParentMap != null)
                    {
                        ParentMap.TranslateMap((Point)(position - mousePosition));
                    }
                }
                mousePosition = position;
            }
        }
Пример #2
0
        protected override void OnMouseRightButtonUp(MouseButtonEventArgs e)
        {
            base.OnMouseRightButtonDown(e);
            MovedLocation ml = this.DataContext as MovedLocation;

            if (ml != null)
            {
                ml.Remove();
            }
        }