private void window_MouseLeave(object sender, MouseEventArgs e) { var mouse_point = new MousePosition(); //Console.WriteLine(mouse_point._GetCursorPos().X.ToString()+" "+ mouse_point._GetCursorPos().Y.ToString()); hid_window = this.Top <= 10 && mouse_point._GetCursorPos().Y != 0 ? true : false; if (hid_window) { double CurrentTop = this.Top; while (CurrentTop >= -this.ActualHeight + 1.5) { CurrentTop += -1; this.Top = CurrentTop; } } }