View Injection

Topics: Prism v4 - WPF 4
Oct 6, 2010 at 1:24 PM

Hello,

Having worked with the SCSF for a number of years I am keen to get a handle on Prism.

I have been working with drop 7 of prism 4.0 and seem to be having an issue with View Injection, the application i'm working on has a standard Master --> Detail set of regions and then a navigation region alongside all of which are contained within the Shell.xaml

I have come across an issue when attempting to inject a view into the DetailRegion based on selection in the Master View, (I need to make use of injection to set the Datacontext of the view) No error messages are encountered and i can see the DetailView added and active within the RegionManager instance however the View does now show in the UI. The logic is plugged in via the Event Aggregator (FYI)

I've tried using a few variations of injection (in line with examples in the quick starts and StockTrader examples) all of which produce the same result, If i choose to use View Discovery to show the detail view then it appears but of course with no data context.

I've just created a simple HelloWord app that just has a Shell and single Module and still cannot get View Injection to work.

Am i missing a step anywhere? Or is the issue around the Region Manager Context seeing as the injection occurs within the Module Controller but is targeting a region in the Shell?

Any pointers would be appreciated.

Thanks

 

 

Oct 6, 2010 at 6:59 PM

Hi,

Nice to see that you started using Prism. I think that you can find interesting that the Drop 9 of Prism has been released. In this drop the Prism Library 4.0 code base are now code complete.

On the other hand, there is not similar issues reported so far. I assume that you need programmatic control when adding the view to your regions and this is why you opted to use View Injection. But I would recommend to you take a look at the following documentation section on MSDN:

  • UI Composition (see the When to Use View Discovery vs. View Injection section)

If you continue experiencing this, could you send the repro sample that you mentioned?

Fernando Antivero
http://blogs.southworks.net/fantivero