This project is read-only.

Alternative for reflection in ApplicationShellApplication.AfterShellCreated

Topics: Developer Forum
Jan 8, 2007 at 1:01 PM
The ApplicationShellApplication.AfterShellCreated method uses reflection to invoke the InitializeComponent method on the Application instance. This can be avoided by applying the following changes:

- Add System.Windows.Markup.IComponentConnector as an inheritance (Contains InitializeMethod and Connect definitions).
- Add dummy Connect method:
void Connect(int connectionId, object target)

- Add IComponentConnector as constraint for TShell
- Change reflection code to:
(Shell as IComponentConnector).InitializeComponent();