MVVM - Binding syntax ?

MVVM - Binding syntax ?

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


cconte posted on Monday, September 12, 2011

Hi folks,

Software: CSLA 4.1 – Bxf –  VS2010

I'm trying to bind my ModelView (CustomerVM.cs) to my View (CustomerView.xaml) without using DesignSource.

In the Navigation class (MainMenuViewModel.cs) the view is called by using Bxf : 

public void LoadLoginPage()

{

Shell.Instance.ShowView(typeof(CustomerView).AssemblyQualifiedName, "customerViewModelViewSource", new ViewModels.CustomerVM(), "MainContent");}

}

My problem is that i dont know the right xaml syntax to make the binding in the View.

I think, it should look to something like that  but it doesnt work.

<mv:MainMenuViewModel x:Key="MenuViewModel"/>

...

<CollectionViewSource x:Key="customerViewModelViewSource" Source="{StaticResource MenuViewModel}" /> 

Thanks in advance for your help,

Best regards,

Cédric

 

sergeyb replied on Tuesday, September 13, 2011

I am guessing you have a property on your MenuViewModel that contains a list of menu items?  If so, you need something like:

<CollectionViewSource x:Key="customerViewModelViewSource" Source="{StaticResource MenuViewModel, Path=MenuItemsProp}" />

cconte replied on Monday, September 19, 2011

thx a lot.

Copyright (c) Marimer LLC