3
Answers

Popup move in WPF

Anuja Godse

Anuja Godse

5y
2.6k
1
I created a WPF Popup Control on my WPF Form. When I click, the Popup Opens and it also moves properly. but when I Clicked on textbox in popup window then popup moves slightly towards the edge of main window. I don't want to move popup when I clicked on textbox in Popup?
 
Here is my code:
  1. private void MyAddJobPopup_MouseMove(object sender,System.Windows.Input.MouseEventArgs e)  
  2. {   
  3. if (!MyAddJobPopup.IsOpen)   
  4.    MyAddJobPopup.IsOpen = true;  
  5.     if (e.LeftButton == MouseButtonState.Pressed)   
  6.    {     var mousePosition =   e.GetPosition(this.HardwareElectricalTbl);   
  7.          this.MyAddJobPopup.HorizontalOffset = mousePosition.X;   
  8.          this.MyAddJobPopup.VerticalOffset = mousePosition.Y;   
  9.    }   
  10. }  
Answers (3)