Code Snippet
class Class1
{
public void Initialize()
{
UIElement wnd = Application.Current.MainWindow;
Mouse.AddMouseMoveHandler(wnd, OnMouse_Move);
}
public void OnMouse_Move(Object sender, MouseEventArgs e)
{
UIElement container = Application.Current.MainWindow.Content as UIElement;
if(container != null)
{
Console.WriteLine("Mouse_Move: {0}", e.GetPosition(container));
}
}
}
public partial class Window1 : System.Windows.Window
{
Class1 cls;
public Window1()
{
InitializeComponent();
cls = new Class1();
cls.Initialize();
}
}