SilverlightApp ElementsFromPoint

4 posts, 0 answers
  1. Jason
    Jason avatar
    3 posts
    Member since:
    Apr 2012

    Posted 17 Sep 2012 Link to this post

    Is there a known issue for this method? I am finding that it only returns elements found in the VisualTree.Root. Meaning that if there are any Popups active/visible, they will not be included in the ElementsFromPoint return list. In this way it is not truly returning all available elements at the given point. Please advise.

  2. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 20 Sep 2012 Link to this post

    Hello Jason,

    You're correct. The current implementation of this method returns only the elements contained in the VisualTree.Root. I filed a bug on this. You can track its progress and vote for the PITS Issue here: Public URL.

    I've also updated your Telerik points for bringing this to our attention.

    Regards,
    Plamen
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  3. Jason
    Jason avatar
    3 posts
    Member since:
    Apr 2012

    Posted 20 Sep 2012 Link to this post

    Thanks Plamen,

    Until the fix is implemented I have worked around the issue using the following in the case of Popups...
    ... pseudo ...
    if ( app.Popups.Count > 0 )
    {
       currentElements = FindElementsFromPoint( p, app.Popups[ index ].VisualTree.Root );
    }
    ... pseudo ... 


     
    public List<FrameworkElement> FindElementsFromPoint( System.Drawing.Point point, FrameworkElement rootFrameworkElement )
    {
        List<FrameworkElement> frameworkElementList = new List<FrameworkElement>();
        SearchElementsForPoint( point, rootFrameworkElement, frameworkElementList );
        return frameworkElementList;
    }
     
    public void SearchElementsForPoint( System.Drawing.Point point, FrameworkElement frameworkElement, List<FrameworkElement> frameworkElementList )
    {
        if ( frameworkElement != null )
        {
            if ( frameworkElement.GetRectangle().Contains( point ) )
            {
                frameworkElementList.Add( frameworkElement );
            }
     
            if ( frameworkElement.Children != null )
            {
                foreach ( FrameworkElement child in frameworkElement.Children )
                {
                    if ( child != null )
                    {
                        SearchElementsForPoint( point, child, frameworkElementList );
                    }
                }
            }
        }
    }


    I look forward to the fix as this is computationally expensive :)


  4. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 21 Sep 2012 Link to this post

    Hi Jason,

    That is excellent! I am glad to hear you found a workable workaround on your own. I really appreciate the update and hope to have this bug fixed soon.

    All the best,
    Plamen
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top