c# - Using Reflection to fill a GUI for rule creation -
For this, I have many objects (request objects) that can be used to create these rules. Because these request items are also used in the recognition of these rules.
For example, I have a TripRequest object with a strip variable 'airline' and a variable 'value'.
I want in my GUI that when you choose 'TriperX' from a different drop-down menu from various request objects, this second dropdown menu is filled with all its areas (airline, price, etc.).
Then when you select one of these fields, then its type (string, int) is required to read so that the GUI is suitable for commercial rules (equal, equal, large, small, etc.) ).
My idea is to use reflection to read the names of all the fields and method from various objects to create such GUIs and use them to fill the GUI. Is it a good practice to use this reflection?
I have not reflected before, so I am thinking that there can be a better way of doing this. I do not want to do all of the hard work because the application needs to be expanded (new object objects, new fields are added in the object) to add more code without a GUI.
my question: What is a good practice reflection to use for this problem? If not, what would you recommend or see?
This is my first question on the Stackshowourflow, if I have done something wrong, please tell me that I can edit or change it.
Thanks for reading :).
You do not use YouTube and data (and Possibly using a suitable metadata to create code and UI from that metadata) or trying to statically analyze your code (possibly Roslin!) To generate the appropriate code, however, The reflection is likely to be very less painful. Possible downsides ... After saying all this, if your data types are usually only bags of properties, the reflection is very straightforward. Here's some toy code that shows you the most relevant tricks, including data binding. Note that it is conventional to use properties rather than bare fields while reflecting on objects.
Comments
Post a Comment