dragging Geometry question

Feb 23, 2009 at 5:05 PM

I'm trying to sort out dragging a Polygon GeometryBase. I'm tangled up in the coords for the
     Point t = e.GetPosition(ui);
    // The UpdateModes produce different results in the GetPosition for the polgon ui
    //GeometryLayer.UpdateModes.ElementUpdate => pixel coords  {490,184}
    //GeometryLayer.UpdateModes.PanOnlyUpdate => logical? {437144.46875,796914.1875}
    //GeometryLayer.UpdateModes.TransformUpdate => ? {13988538,25501254}

                double ux = Canvas.GetLeft(ui);  //ux=0
                double uy = Canvas.GetTop(ui);  //uy=0

Actually changing all of the Geometry Pathbase points with each mouse move event will work for a calculated polygon, but doesn't seem too convenient for normal loaded polygons.
        private void fencePolygon_MouseMove(object sender, MouseEventArgs e)
            if (isMoving)
                var ui = sender as Polygon;
                if (ui != null)
  Point p = MapInstance.CoordHelper.PixelToGeo(e.GetPosition(MapInstance));
  double d = 0.0006;
  var fencePts = new ObservableCollection<Point> { new Point(p.X + d, p.Y + d), new Point(p.X + d, p.Y - d), new Point(p.X - d, p.Y - d), new Point(p.X - d, p.Y + d) };
  ui.Points = fencePts;

Canvas doesn't seem to help me much:
                    Canvas.SetLeft(ui, e.GetPosition(MapInstance).X);
                    Canvas.SetTop(ui, e.GetPosition(MapInstance).Y);

I am not sure what the ui.AnchorPoint does. I was hoping  it could be used to follow the mouse position, but I haven't seemed to hit on the right combination.

I didn't see a transform method in the Geometry. Maybe there is some way to apply GeometryLayer transforms to a geometry?

  private void UpdateLayerTranforms()
            if (RenderTransform != null)


Any pointers to get me started in the right direction?