How to get access to window elements

179 views Asked by At

I am writing a program that will get user inputs and store data about GUI elements, which user has clicked in desktop applications.

I need data from GUI like: element name, element description, class, element parent, children, etc.

Code is written on C#. As i found out, i can use Xamarin.Mac to call macOs AppKit API from C# (https://learn.microsoft.com/en-us/dotnet/api/appkit.nsapplication?view=xamarin-mac-sdk-14). Now the question is what do i call to get this data?

Or is there any alternative way to get this data?

1

There are 1 answers

1
G.Medina On

First, from the XAML part, make sure the objects have a name defined and that they are public after you can call the variable name in the C# code, and from there put a dot (".") many methods, attributes, and options will appear, for example, you are asking about the children, you could use

var titleBarChildre = AppTitleBar.Children.ToList();

etc.