Does anyone know if the same functionality for displaying views depending on object/viewmodel is applicable to Silverlight 3?
Like this:
<Application.Resources>
<DataTemplate DataType="{x:Type vm:CustomerViewModel}">
<view:CustomerView />
</DataTemplate>
<ContentControl Content="{Binding Path=CurrentView}"/>
public class RootViewModel : BaseViewModel
{
private BaseViewModel _currentView;
public BaseViewModel CurrentView
{
get { return _currentView; }
set
{
_currentView = value;
RaisePropertyChanged("CurrentView");
}
}
public void ShowCustomer()
{
CurrentView = IoC.Resolve<Customerviewmodel>();
}
}
Sorry about the formatting. Can't seem to get it right...
/Johan