jz
13 years agoNew Contributor
How to generate Click event on a WPF menuItem
Under context menu i can get all the menuItems
but when i try to click
menuItem1["Click"](12,4);
it says the method is not supported
i can focus each menuItem but cannot generate the click on an menuItem as i iterate through the collection of contextMenu
var m1 = contextMenuBar["Items"];
var flag = 0;
var countMenuItem = 0;
for (var i=0; i < m1.Count ; i++)
{
var t1 = m1.Item(i);
var ctrlName = t1.ClrClassName;
if ( ctrlName != "MenuItem" )
{
continue;
}
if ( ctrlName == "MenuItem" )
{
var h1 = t1.Text.OleValue;
Log["Message"]("Current Menu Item is "+h1);
Log["Message"]("Current Menu Item Item Index "+countMenuItem)
t1["Focus"];
t1["Click"](12,12); // this does not work it give error on runtime
Any help regarding this will be appreciated. Already spent too much time on it.
I think it is the about WPF that i am not getting it
i will post it to the support also
DEv is saying i should do the raiseEvent
but how can i create the raiseEvent type in testcomplete
t1["RaiseEvent"](e)
how can generate e which is System.Windows.RoutedEventArgs
but when i try to click
menuItem1["Click"](12,4);
it says the method is not supported
i can focus each menuItem but cannot generate the click on an menuItem as i iterate through the collection of contextMenu
var m1 = contextMenuBar["Items"];
var flag = 0;
var countMenuItem = 0;
for (var i=0; i < m1.Count ; i++)
{
var t1 = m1.Item(i);
var ctrlName = t1.ClrClassName;
if ( ctrlName != "MenuItem" )
{
continue;
}
if ( ctrlName == "MenuItem" )
{
var h1 = t1.Text.OleValue;
Log["Message"]("Current Menu Item is "+h1);
Log["Message"]("Current Menu Item Item Index "+countMenuItem)
t1["Focus"];
t1["Click"](12,12); // this does not work it give error on runtime
Any help regarding this will be appreciated. Already spent too much time on it.
I think it is the about WPF that i am not getting it
i will post it to the support also
DEv is saying i should do the raiseEvent
but how can i create the raiseEvent type in testcomplete
t1["RaiseEvent"](e)
how can generate e which is System.Windows.RoutedEventArgs