Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
Tokci123 Absent Member.
Absent Member.
394 views

FindAll does not get all ChildO Objects in List

Hi All,

I need to scroll to an element present in table for WPF application, the value is dynamically provided during run time.

I have below code which runs fine for small listview  as scrollbar moves correctly but does not scroll to elements nearing end of long list.

My list is as below and I scroll using names ( A1, A2 ) etc

A1   1   3  

A2   1   5

S1   1   3  

Q2   1   5

.....

.....

Z7   1   3  

Z82   1   5

Z9   1   3  

 

Imports SilkTest.Ntf.Wpf
Public Module Main
     Dim _desktop As Desktop = Agent.Desktop
     Public Sub Main()
            Dim iPosition As Double = 0.5
            Dim iSumPosition As Double = 0.0
            Dim sObjlocator As String = "//WPFListView[@automationId='MyListView']"
            Dim sData As String = "Z118"
            Dim sObjSublocator As String = "//WPFToggleButton[@caption='*']"


            Dim rows As IList = _desktop.WPFListView(sObjlocator).FindAll(sObjSublocator)


            Dim sObjExist As Boolean = False


            For Each row As WPFToggleButton In rows
                 Dim sString As String = row.Text
                 Console.WriteLine(sString)     '  <--names
                 If Trim(sString) = sData Then
                        sObjExist = True
                             Exit For
                 Else
                 iSumPosition += iPosition
                 Console.WriteLine(iSumPosition)  ' <--Position

               _desktop.WPFListView(sObjlocator).ScrollToPosition(iSumPosition, Orientation.Vertical)
                 End If
           Next
    End Sub
End Module

 

Issue: In output below A1 , A10 etc from Console.WriteLine(sString) and  numbers from Console.WriteLine(iSumPosition) ,it works for few objects not in screen  and scrollbar moves vertically down but If my list is large and I need scroll many times then I face issue.

 Scroll bar does not scroll to end for names nearing end of list, if my list is very small then it scrolls down to very last element as well.

In Debug mode I see rows list (Dim rows As IList = _desktop.WPFListView(sObjlocator).FindAll(sObjSublocator)) does not have value (names) for elements nearing end of list.

In output below ,we can see names  & positions are printed initially but in end(for long list) only positions are printed.

Output:

A1
0.5
A10
1
A11
1.5
A12
2

...

...

...

9.5

10

10.5

 

Any suggestions will be appreciated 

Additional info:

WPFScrollBar

 

WPF pre-fill forms settings is : yes

 

Tokci

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.