privatevoid UserControl_MouseEnter(object sender, MouseEventArgs e) { var canvas = sender as UserControl; if (canvas==null) return; var point = e.GetPosition(canvas); var dp = canvas.InputHitTest(point) as DependencyObject; var btn = dp.FindAncestor<Button>(); if (btn==null) return; ButtonWidth = btn.Width; ButtonHeight = btn.Height; } }