Forum Discussion

cp_net's avatar
cp_net
Occasional Contributor
14 years ago

How to access non-visual properties.

I have a WPF form which contains a property such as:



public MyFieldType MyField

{

    get { return _myField; }

}



MyFieldType is a custom class with various properties and such.



I cannot seem to access the MyField property in the ObjectMap. Is this possible?

2 Replies

  • Hi,



    Can you access this property from scripts? If you obtain your object and address this property, what result do you get (try this on a breakpoint)?
  • cp_net's avatar
    cp_net
    Occasional Contributor

    Actually, after some more analysis, here's the scenario in more details:



    public class MyCustomBox : TextBox

    {

        public MyFieldType MyField

        {

            get { return _myField; }

        }

    }



    As, you can see this has only a get accessor, but no set.



    If I add this class as a property to a WPF Window, I cannot get direct access to Window.MyCustomBox.MyField (in script and object browser). However, I can access the method get_MyField and private field zmyField.

    But when I add a public set accessor to above class, I can access the Window.MyCustomBox.MyField property from TestComplete.