Hi, I'm trying to select an item in a listBox programmatically. The idea is that I want to search and display and item, that is in a listbox.
I couldn't find anywhere how to do it. Is it possible? This is my code:
public void btnSearchProd_Clicked(object sender, ClickedEventArgs e)
{
XPathNavigator domNav = MainDataSource.CreateNavigator();
XPathNavigator paramItemNav = domNav.SelectSingleNode("/my:meusCampos/my:txtBoxes/my:myProductDesc", NamespaceManager); //Field that cointains the search argument
XPathNodeIterator listItemNav = domNav.Select("/my:meusCampos/my:rightList/my:rightListItem", NamespaceManager);
XPathNavigator listNav = domNav.SelectSingleNode("/my:meusCampos/my:rightList", NamespaceManager);
//Cycle through all items in the list
while (listItemNav.MoveNext())
{
if (listItemNav.Current.Value.LastIndexOf(paramItemNav.Value) != -1)
{
// OK, found the item, now want to select it, so the user can see it. Tried several things, but nothing worked
XPathNavigator newNode = listItemNav.Current.Clone();
//What do I do here??????????
//newNode.InsertAfter(newNode);
//listNav.AppendChild(newNode);
//listNav.MoveTo(listItemNav.Current);
//listNav.PrependChild(listItemNav.Current);
//newNode.MoveTo(newNode);
//newNode.SetValue(listItemNav.Current.Value);
//listNav.SetValue(newNode.Value);
//listNav.AppendChild(newNode);
break;
}
}
Thanks in advance for any help.
Regards,
Fábio