Anuja Godse

Anuja Godse

  • NA
  • 27
  • 5.9k

Popup move in WPF

Sep 23 2019 4:14 AM
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)