Forum Discussion

amithsid's avatar
amithsid
Contributor
11 years ago
Solved

WPF Combobox

How to perform a ClickItem("text") action on a WPF Combobox, Instead of using Index?

  • Hi Amith,


     


    Is Data Binding used in your control? At the moment, only accessing by index is possible for such controls.


    Please refer to this post to learn the approach you can use.


     

4 Replies

  • Hello,



    Work around for WPF Combobox which does not have data binding associated with them-

    follow the below script


    function cboSelectWPF(obj,value)


    {


    itemcount=aqObject.GetPropertyValue(obj,wItemCount);


     


    for(i=1; i<itemcount; i++)


    {


    getitem=aqObject.GetPropertyValue(obj,wText);


    if(getitem==value)


    {


    return Keys("[Enter]");


    }


    else


    {


    Keys("[Down]");


    Keys("[Enter]");


    }  } }

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Amith,


     


    Is Data Binding used in your control? At the moment, only accessing by index is possible for such controls.


    Please refer to this post to learn the approach you can use.


     

  • Hi Tanya,



    Thanks for your reply, I didn't get what is data bonding actually, as far as I understand one of the 

    type of WPF Combobox doesn't have data associated to it.

    I have also attached a screenshot, the wItemList property returns an empty string.



    only Index method works in this case?



    Thank you,

    Amith
  • Hello,



    What is rhe action to be taken for a WPF combobox which does not have data binding associated with it? 



    Thank you,

    AMITH N G