none
placing pop up based on the mouse position(x,y)

    Question

  •  private void DG_LoadingRow(object sender, DataGridRowEventArgs e)
            {
                DataGridRow row = e.Row;

                int index = 0;

                foreach (DataGridColumn col in DG.Columns)
                {

                    if(col.Header == "ID" || col.Header == "Name")  // only assign mouse enter event for selected columns

                    {
                    FrameworkElement cellContent = col.GetCellContent(e.Row);
              
                    DataGridCell cell = cellContent.Parent as DataGridCell;

                    
                    cell.MouseEnter -= cell_MouseEnter;
                    cell.MouseEnter += new MouseEventHandler(cell_MouseEnter);
                    cell.MouseLeave -= cell_MouseLeave;
                    cell.MouseLeave += new MouseEventHandler(cell_MouseLeave);      

                    }        
                }
            }

            void cell_MouseLeave(object sender, MouseEventArgs e)
            {
     
                //Hide your popup
            }

            void cell_MouseEnter(object sender, MouseEventArgs e)
            {
               // here i need  to get the  mouse position that is its x,y value   based on that i can  place my modal pop up in that postion.

    my pop is  define din xaml page here i will be assigning only its position where i need to place my modal pop up.

                // Show your popup
            }

    Monday, May 24, 2010 1:24 AM

Answers

  • Hi,

       Try something alike below in your mouse enter event:

                Point i = e.GetPosition(root);
                Popup p = new Popup();
                p.Child = new TextBox() { Text="Text" };
                p.HorizontalOffset = i.X;
                p.VerticalOffset = i.Y;
                p.IsOpen = true;

    Best Regards

    Sunday, May 30, 2010 10:01 PM

All replies

  • See this

    Monday, May 24, 2010 1:33 AM
  • this may be also helpful

    Monday, May 24, 2010 1:38 AM
  • this link related to the mouse position

    Tuesday, May 25, 2010 12:15 AM
  • Did you try calling e.GetPosition() in your cell_MouseEnter method and using the returned Point to position the Popup?


    Tuesday, May 25, 2010 12:51 AM
  • Hi,

       Try something alike below in your mouse enter event:

                Point i = e.GetPosition(root);
                Popup p = new Popup();
                p.Child = new TextBox() { Text="Text" };
                p.HorizontalOffset = i.X;
                p.VerticalOffset = i.Y;
                p.IsOpen = true;

    Best Regards

    Sunday, May 30, 2010 10:01 PM