I want to do something "user control-like". My plan is something along the lines of:
* Create a class which will create the needed controls/views in it's Initialize, using a supplied panel as host.
* Keep this class as self-contained as possible. This means that once it's created, the activity which created it should not have to bother with internal stuff. For example, some of the views will not fire events to the activity, they will be kept internal to the class. Another mechanism will be supplied to talk to the activity.
Example: Say that I have a database and make a custom view for some CRUD operations on a table. This is more or less self contained, and the activity has no need to know each click, it just needs a message when a change was saved. I don't want the code that belongs in the custom view to contaminate the activity (especially if I need the custom view in several places in the app). Also, in my practical case, the view could be widely different, the activity just knows "load this class" and shouldn't have to know anything more.
All this is fairly simple, except for one thing: How do I get the contained controls in the custom view to fire events in the class, instead of in the activity?
* Create a class which will create the needed controls/views in it's Initialize, using a supplied panel as host.
* Keep this class as self-contained as possible. This means that once it's created, the activity which created it should not have to bother with internal stuff. For example, some of the views will not fire events to the activity, they will be kept internal to the class. Another mechanism will be supplied to talk to the activity.
Example: Say that I have a database and make a custom view for some CRUD operations on a table. This is more or less self contained, and the activity has no need to know each click, it just needs a message when a change was saved. I don't want the code that belongs in the custom view to contaminate the activity (especially if I need the custom view in several places in the app). Also, in my practical case, the view could be widely different, the activity just knows "load this class" and shouldn't have to know anything more.
All this is fairly simple, except for one thing: How do I get the contained controls in the custom view to fire events in the class, instead of in the activity?