capture mouse position in a floatable window

Aug 17, 2010 at 12:20 PM

hi. i am looking for a way to capture mouse position inside the floatable window. i have tried the following 2 without success:

      private void _widGB_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
      {
         FloatableWindow w = (FloatableWindow)sender;
         Point p = e.GetPosition(w);

         _widgetLeft = ((int)p.X < 0) ? 0 : (int)p.X;
         _widgetTop = ((int)p.Y < 0) ? 0 : (int)p.Y;
      }

and this only gives me the initial position, it does not update after dragging the window.

GeneralTransform gt = element.TransformToVisual(Application.Current.RootVisual);

Point offset = gt.Transform(new Point());
double mousePos = offset.X;

please help.