We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

GridTreeControl Seems to Steal Focus

No matter what I do it seems that the GridTreeControl steals focus.  

What I'm doing is in the DoubleClick of the grid is the following:

              Point p = e.GetPosition(this.myGrid);
                var cell = this.myGrid.InternalGrid.PointToCellRowColumnIndexOutsideCells(p, false);

                if (cell.RowIndex > 0 && cell.ColumnIndex > 0 && myGrid.InternalGrid != null)
                {
                    GridTreeNode selNode = myGrid.InternalGrid.GetNodeAtRowIndex(cell.RowIndex);
                    if (selNode != null && selNode.Item is MyRecordData)
                    {
                        MyRecordData dfo = selNode.Item as MyRecordData;
                        if (dfo != null)
                        {
                            VM.SelectedRecord = dfo;
                        }
                    }
                }



                if (VM.SelectedRecord != null)
                {
                       MyNewForm frm = new MyNewForm(VM.SelectedRecord);
                       frm.Show();
                       frm.Activate();
                 }


I am doing this as I may have to travers to find a parent node if a child is selected to get to the correct detail form.  However for now I have kept it simple.  

Whenever I doubleclick to open my form the form ALWAYS opens behind my current form. I have tried focus events, activate items, all kinds of settings on both forms and it always opens behind.  

I cannot make this a dialog as they can double click on multiple records in the source screen and open the details for many records.  

Any help?  If I exectue from a button vs doubleclick it works fine.  Every time.  but double click just seems to steal the focus.  

And while I have this issue in the WPF control I have seen it in previous versions of the grid control for winforms too, as far back as syncfusion version 5.   

Thanks.


1 Reply

SH Shakul Hameed M Syncfusion Team December 18, 2013 10:33 AM UTC

Hi Joshua,

 

Thanks for contacting Syncfusion.

 

We have analyzed your query and we can achieve your requirement by setting the owner for the form loaded.

Please refer the following code snippet.

 

Code Snippet:[C#]

if (VM.SelectedRecord != null)

            {

                MyNewForm frm = new MyNewForm();

                frm.Owner = this;

                frm.Show();            

            }   

 

 

I have prepared the sample based on your requirement and please find the  attached sample.

 

Please let us know, if you have any query.

 

Thanks,

Shakul Hameed




Focus_ce3ee913.zip

Loader.
Live Chat Icon For mobile
Up arrow icon