private void InjectPropertiesForChildViews(IComponentContext context, IPresentationBusConfiguration bus, UIElement uiElement) { var userControl = uiElement as UserControl; if (userControl != null) { InjectProperties(context, bus, userControl.Content); return; } var panel = uiElement as Panel; if (panel != null) { foreach (var child in panel.Children) { InjectProperties(context, bus, child); } return; } var contentControl = uiElement as ContentControl; if (contentControl != null) { InjectProperties(context, bus, contentControl.Content as UIElement); return; } }
private void InjectProperties(IComponentContext context, IPresentationBusConfiguration bus, UIElement uiElement) { if (uiElement == null) return; context.InjectUnsetProperties(uiElement); var subscriber = uiElement as IHandlePresentationMessages; if (subscriber != null) { bus.Subscribe(subscriber); } InjectPropertiesForChildViews(context, bus, uiElement); }