I'm creating a modular type system were one application(host) loads other modules in to a common UI interface, I have also created an API for this and is available for other users to use.
The API in some instances uses interfaces and abstract classes to force the client using the API to implement the specific methods.
I cannot use interfaces for everything as there are some things were I require putting in my own body so the end user does not need to implement all the unnecessary events and methods himself. EG: So I handle the size changing events myself then pass him the size to a function he implements from called SizeChanged were he can handle his program from the size change.
Abstract classes are what I really want to use but I cannot because the controls the user has may need the x:Name specified in XAML and will recieve the error:
The type ... cannot have a Name attribute. Values types and types without a default constructor can be used as items within ResourceDictionary.
The error occurs because an instance of it needs to be created: Inherited Window can not have a name?
The only solution available to me that I know of is to use a regular class with virtual methods that can be overridden and that does work fine but it does not force the user to implement my methods that are required.
Is there anything I can do cleanly such as any public implementable or something?
This is the structure:
API: IContext -> ContextControl -> (Abstract methods)
Module DLL ContextControl(API) -> AppContextControl(Override methods)
Host Application pull's AppContextControl
I know I can tell the module dev to implement an interface as well as this ContextControl that constrains them to implement the interfaces but it would be much more professional for the compiler to tell them.
In the dev module if I instead of inheriting from ContextControl I implement IContext then I lose all the default bodys and the module dev gotta implement a lot lot more.
Cheers.