Search This Blog

Tuesday, August 23, 2011

PRISM passing data in RegionContext

Define region in the following way - with regionName and region context defined

xmlns:regions="clr-namespace:Microsoft.Practices.Prism.Regions;assembly=Microsoft.Practices.Prism"

<ItemsControl MinHeight="400" regions:RegionManager.RegionName="RCP.WorkerShowPersonalDataRegion" regions:RegionManager.RegionContext="{Binding Path=CurrentWorker, Mode=TwoWay}" >
    <!-- PRISM registers various types of configuration views here -->
</ItemsControl>

 

Receive Context in ViewModel like this:
this.RegionContext = regionManager.Regions[RegionNames.WorkerShowPersonalDataRegion].Context;

This can be done in Constructor or e.g. OnNavigatedTo method from PRISM INavigationAware.

1 comment:

If you like this post, please leave a comment :)