Hello,
I was using the CTP version of this control in a project that utilizes Prism to layout defined regions on the screen. Using the CTP version, I had no problems.
Today I upgraded to the release version and now I get an error when trying to add the control to the region. If I do not try to use the control as a region container, it runs fine.
Thanks in advance.
Could you provide some more information: the error message that you are getting and the CTP version that you were using before the upgrade - was it March or June CTP version? Some design changes were made in the release version and providing this information will be helpfull to understand what's actually happening. Also, do I understand you correctly, that you use the TileView as a Region? The TileView control is not actually an ItemsControl , so my first guess is that this is the reason it's not working. The Items collection of the TileView control is a collection of TilePanes in the release version, and it was a collection of Objects in some of the CTP versions, so perhaps this is the reason why it's happening.
Hope this helps,
Georgi,
Thanks for the reply.
The version I was using in CTP was 9.1.20091.278 Not sure if it was March or June.
Yes, I am setting a region on the XamWebTileView itself.
The error is not very specific...
Microsoft.Practices.Composite.Presentation.Regions.UpdateRegionsException was unhandled by user code Message="An exception occurred while trying to create region objects. \r\n - The most likely causing exception was: 'System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.Practices.Composite.Presentation.Regions.Behaviors.RegionCreationException: An exception occurred while creating a region with name 'Header'. The exception was: Microsoft.Practices.Composite.Presentation.Regions.UpdateRegionsException: An exception occurred while trying to create region objects. \r\n - The most likely causing exception was: 'System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.Practices.Composite.Presentation.Regions.Behaviors.RegionCreationException: An exception occurred while creating a region with name 'Navigation'. The exception was: Microsoft.Practices.Composite.Presentation.Regions.UpdateRegionsException: An exception occurred while trying to create region objects. \r\n - The most likely causing exception was: 'System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.Practices.Composite.Presentation.Regions.Behaviors.RegionCreationException: An exception occurred while creating a region with name 'Left'. The exception was: Microsoft.Practices.Composite.Presentation.Regions.UpdateRegionsException: An exception occurred while trying to create region objects. \r\n - The most likely causing exception was: 'System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.Practices.Composite.Presentation.Regions.Behaviors.RegionCreationException: An exception occurred while creating a region with name 'Main'. The exception was: System.Collections.Generic.KeyNotFoundException: controlType\r\n at Microsoft.Practices.Composite.Presentation.Regions.RegionAdapterMappings.GetMapping(Type controlType)\r\n at Microsoft.Practices.Composite.Presentation.Regions.Behaviors.DelayedRegionCreationBehavior.CreateRegion(DependencyObject targetElement, String regionName). ---> System.Collections.Generic.KeyNotFoundException: controlType\r\n at Microsoft.Practices.Composite.Presentation.Regions.RegionAdapterMappings.GetMapping(Type controlType)\r\n at Microsoft.Practices.Composite.Presentation.Regions.Behaviors.DelayedRegionCreationBehavior.CreateRegion(DependencyObject targetElement, String regionName)\r\n --- End of inner exception stack trace ---\r\n ... (lots of stack trace info snipped).
If I remove the region from the XamWebTileView, then all the other regions load fine.
Thanks,Scott
Hi, Scott
I toke a closer look on your problem and here's what I found:
MSDN says that: "A RegionName can be applied to the an ItemsControl and its derived controls (for example, ListBox); Selector and its derived controls (for example, TabControl); and ContentControl and its derived controls (for example, ScrollViewer)."
In the CTP version that you were using (build 278), the xamWebTileView was derived from ItemsControl and that's why it was working properly. In the release version the xamWebTileView is derived from Control and thus the RegionName attached property is not expected to work correctly. Unfortunately, that means you will not be able to use the xamWebTileView as a Region container using out of the box functionality.
However, I found this article, which describes how you can use your own Region container (e.g. xamWebTileView) by creating a Region Adapter for the corresponding type:
http://johnpapa.net/silverlight/fill-my-prism-region-please/
Hope that helps,
Thanks for the response. This is exactly what we ended up doing yesterday. :)
Scott