有谁知道根据对象/视图模型显示视图的相同功能是否适用于 Silverlight 3?
像这样:
<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>();
}
}
对不起格式。似乎无法正确...
/约翰