Oct 07, 2010, 10:11 AM
[CLOSED] Extending Components and Overriding properties
From what I have seen in the source, you never extend Components as is done by ExtJs, e.g. instead of extending Window from Panel, you create base classes PanelBase, and extend both Window and Panel from PanelBase.
Same is true for form components e.g. DateField extending TriggerFieldBase etc.
In my understanding, this is done to overcome issues with co-variance and contra-variance in overriding (which are not permissible in C# n overriding scenarios). e.g. this prevents issues in overriding the Listeners property where Panel would have PanelListeners but Window would have WindowListeners.
Is this correct?
Now, what would you suggest for extending components? e.g. I need to extend Window client-side with custom events, and need to do on the server-side the same. I have extended Window, extended WindowListeners and hide Listeners property on my new CustomWindow class. But I get a Parser Error: Ambiguous match found:
Same is true for form components e.g. DateField extending TriggerFieldBase etc.
In my understanding, this is done to overcome issues with co-variance and contra-variance in overriding (which are not permissible in C# n overriding scenarios). e.g. this prevents issues in overriding the Listeners property where Panel would have PanelListeners but Window would have WindowListeners.
Is this correct?
Now, what would you suggest for extending components? e.g. I need to extend Window client-side with custom events, and need to do on the server-side the same. I have extended Window, extended WindowListeners and hide Listeners property on my new CustomWindow class. But I get a Parser Error: Ambiguous match found:
Parser Error Message: Ambiguous match found.
Source Error:
Line 44: <portal:PortalWindow Title="Hello">
Line 45: <Listeners>
Line 46: </Listeners>
Line 47: </portal:PortalWindow>
Last edited by Daniil; Oct 13, 2010 at 11:31 AM.
Reason: [CLOSED]