Wierd WPFListbox issues - can't get the wItem listings
I have a WPF Listbox that I am trying to select a specific item, but cannot guarantee that the item's index will always be the same.
Aliases.UTSEnterprise1.HwndSource_ApplicationWindow.ApplicationWindow.LayoutRoot.zWorkspaceGrid.zAppDock.LayoutRoot.zAppDock.BankDeposit.Grid.zLayoutRoot.zScrollViewer.zPageForm.zStackAllExpanders.zexpF1_Step3_CreatePrepareBankDeposit.zgrdLayout_Step3_F1.zstkStep3_F1.zgrd_F1_B.zstkDepositBags.zmultiselectDepositbags.zLayoutGrid.zSourceListBox.WPFObject("ListBoxItem", "", 1).WPFObject("Grid", "", 1).WPFObject("TextBlock", "Bag48474-1", 1).Name
This is the object I am looking for, and the caption/text is the "Bag48474-1"
I've looked at the Help and the Forums and nothing I try seems to get me to select the item in question.
I can select it via index and I can select all, but as I don't know what the index is if it's not the only item listed, I can't use that method to select it - the manual testers could have bags that they need for testing.
Here is the latest iteration of testing I have done to try and select the item.
Sub Test1
Dim i, Item, Del, ItemString
Dim msg
Dim scrollViewer
Dim listBox
Set scrollViewer = Aliases.UTSEnterprise1.HwndSource_ApplicationWindow.ApplicationWindow.LayoutRoot.zWorkspaceGrid.zAppDock.LayoutRoot.zAppDock.BankDeposit.Grid.zLayoutRoot.zScrollViewer
Set list = scrollViewer.zPageForm.zStackAllExpanders.zexpF1_Step3_CreatePrepareBankDeposit.zgrdLayout_Step3_F1.zstkStep3_F1.zgrd_F1_B.zstkDepositBags.zmultiselectDepositbags.zLayoutGrid.zSourceListBox
' Obtain the list of items and current delimiter
ItemString = list.wItemList
Del = list.wListSeparator
aqString.ListSeparator = Del
' Extract particular items and post them to log
For i = 0 To list.wItemCount - 1
Item = aqString.GetListItem(ItemString, i)
msg = MkSet(mbOK)
msg = MessageDlg(Item, mtConfirmation, msg, 0)
Next
End Sub