varghesejim
11 years agoOccasional Contributor
WPF Menu Selection
Out application have a menu.Clicking/hovering over a menu item will bringup child menu items on the right hand side.
I would like to select a menu item from the multi level menu. I am using the following code(Assume we have a menu like Cars->BMW, Bentley, Honda)
var popuproot,arrayproperties,arraypropertyvalues, menuitem, anotheritem;
popuproot = GetPopuproot();
popuproot.Refresh();
arrayproperties=Array("ClrClassName","Header.DisplayName","ClrFullClassName");
arraypropertyvalues=Array("XamMenuItem","Cars","Infragistics.Controls.Menus.XamMenuItem");
menuitem= popuproot.FindChild(arrayproperties,arraypropertyvalues,20);
if( menuitem.Enabled==true)
{
menuitem.Click();
Delay(100);
arraypropertyvalues=Array("XamMenuItem","BMW","Infragistics.Controls.Menus.XamMenuItem");
anotheritem = menuitem.FindChild(arrayproperties,arraypropertyvalues,20);
if( anotheritem.Enabled==true)
{
anotheritem.Click();
}
}
I can see the the list of cars as a result of the first click(). However I am not able to click on "BMW". It fails saying that object does not exist(anotheritem)
Any help is appreciated
I would like to select a menu item from the multi level menu. I am using the following code(Assume we have a menu like Cars->BMW, Bentley, Honda)
var popuproot,arrayproperties,arraypropertyvalues, menuitem, anotheritem;
popuproot = GetPopuproot();
popuproot.Refresh();
arrayproperties=Array("ClrClassName","Header.DisplayName","ClrFullClassName");
arraypropertyvalues=Array("XamMenuItem","Cars","Infragistics.Controls.Menus.XamMenuItem");
menuitem= popuproot.FindChild(arrayproperties,arraypropertyvalues,20);
if( menuitem.Enabled==true)
{
menuitem.Click();
Delay(100);
arraypropertyvalues=Array("XamMenuItem","BMW","Infragistics.Controls.Menus.XamMenuItem");
anotheritem = menuitem.FindChild(arrayproperties,arraypropertyvalues,20);
if( anotheritem.Enabled==true)
{
anotheritem.Click();
}
}
I can see the the list of cars as a result of the first click(). However I am not able to click on "BMW". It fails saying that object does not exist(anotheritem)
Any help is appreciated