using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; namespace WPF路由事件_7_鼠标状态; /// /// Interaction logic for MainWindow.xaml /// public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void UIElement_OnMouseMove(object sender, MouseEventArgs e) { var position = e.GetPosition(this); Console.WriteLine($"x:{position.X},y:{position.Y}"); } }