Forum Discussion

EgorKa's avatar
EgorKa
Occasional Contributor
12 years ago

How to select item in context menu(DevExp WPF )

Hello all,

could you please help me?



I work with .NET application,DevExpress wpf forms.

I need to select Item from context menu. How to identify whether item is enabled or not.





Best regards,

Egor

6 Replies

  • Hi


    Each onscreen object has a specific Enabled property. Use this property in your tests to check whether a certain item is enabled.


    I hope this helps.


    Ann

  • EgorKa's avatar
    EgorKa
    Occasional Contributor
    Hi Ann,



    I have this option for PopupMenu, not for Items.

    The point is that i'm able to define necessary Item by using property WPFControlText and navigating over menu using Keys method.

    Maybe there are alternative methods to select appropriate item.(((?



    Best regards,

    Egor
  • Hi,


    Could you please attach here a sample application with your menu control? If you cannot do this for some reason, please specify the class name of your menu.


    Thanks in advance.

    Ann

  • EgorKa's avatar
    EgorKa
    Occasional Contributor
    Hi Ann,

    Here is a class: DevExpress.Xpf.Bars.PopupMenuBarControl.



    By the way i found property IsEnable a little bit deeper on this way: 

    Aliases["Grip_UI_Wpf"]["HwndSource_PopupRoot"]["PopupRoot"]["Decorator"]["NonLogicalAdornerDecorator"]["BarPopupBorderControl"]["PopupMenuBarControl"]["Items"]["Item"](i)["Content"]["IsEnabled"]



    Best regards,

    Egor
  • Hi,


    Well, and did you check whether this property is appropriate for your testing needs?  Since the property is a native property of the Developer Express control, I suggest that you refer to the Developer Express documentation to find the complete description of a property.


    By the way, I see that you can get a certain menu item in the following way:


    Aliases["Grip_UI_Wpf"]["HwndSource_PopupRoot"]["PopupRoot"]["Decorator"]["NonLogicalAdornerDecorator"]["BarPopupBorderControl"]["PopupMenuBarControl"]["Items"]["Item"](i)


    That means that you are working with individual menu items via TestComplete's MenuItem object. And this object has the Enabled property for sure. Please refer to TestComplete's help for detailed information.


    I hope this helps.

    Ann

  • EgorKa's avatar
    EgorKa
    Occasional Contributor
    Hi Ann,



    Yes, i checked this property, it works properly(i used it)





    By the way, I see that you can get a certain menu item in the following way:





    Aliases["Grip_UI_Wpf"]["HwndSource_PopupRoot"]["PopupRoot"]["Decorator"]["NonLogicalAdornerDecorator"]["BarPopupBorderControl"]["PopupMenuBarControl"]["Items"]["Item"](i)




    That means that you are working with individual menu items via TestComplete's MenuItem object. And this object has the Enabled property for sure. Please refer to TestComplete's help for detailed information.





    Maybe i've missed something, but i've not found here property Enabled and i can choose Item only bu number(index).



    Any way, thank you!



    Best regards,

    Egor