Prism & Silverlight: Part 6 - Shells, Regions, Views

Play Prism & Silverlight: Part 6 - Shells, Regions, Views

The Discussion

  • User profile image

    Hi Mike,
    can you please publish the version of the prism library this code was written for?

  • User profile image

    At the 28 minute mark, Mike describes code where neither the View creates the ViewModel nor vice-versa.  Here is some code you could add to your module definition (or other appropriate place for doing your region manager work) to do so.

    Private Sub RegisterViewWithRegion(Of ViewType As UserControl, ViewModelType)(ByVal regionName As String)
        Dim viewModel = _container.Resolve(Of ViewModelType)()
        Dim view = _container.Resolve(Of ViewType)()
        view.DataContext = viewModel
        _regionManager.RegisterViewWithRegion(regionName, Function() view)
    End Sub

Add Your 2 Cents