How to "connect" Views and ViewModels using a HyperLink in SL Navigation?

How to "connect" Views and ViewModels using a HyperLink in SL Navigation?

Old forum URL: forums.lhotka.net/forums/t/11406.aspx


superkuton posted on Monday, June 11, 2012

I am trying to use a theme for a Silverlight project which uses the SL Navigation Framework, thus I have a Page, a View and a ViewModel.

I have a hyperlink which "calls" the page:

<HyperlinkButton Content="HyperlinkButton" 
                         Name="hyperlinkButton1" NavigateUri="Testing/SampleListView"
                         VerticalAlignment="Top" Width="100" />

 

I have a view which instantiates the ViewModel with the following code:

    <navigation:Page.DataContext>
        <my:SampleListViewModel />
    </navigation:Page.DataContext>

I have set the following CVS in the view:

<UserControl.Resources>
        <CollectionViewSource x:Key="sampleListViewModelViewSource" d:DesignSource="{d:DesignInstance my:sampletListViewModel, CreateList=True}" />
        <CollectionViewSource x:Key="sampleListInfoViewModelModelViewSource" Source="{Binding Path=ItemList, Source={StaticResource sampleListViewModelViewSource}}" />
    </UserControl.Resources>

 

When I break through the viewmodel, it contains the data "fetched" but it is not displaying in my view. Using the same View and ViewModel, and Bxf, I am able to display the data in the view. I just can not get it to work in the SL Navigation Framework. I just wonder what am I doing wrong.

Any help is appreciated. Thanks.

Copyright (c) Marimer LLC