0

オブジェクト/ビューモデルに応じてビューを表示するための同じ機能が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>();
}

}

整形でごめんなさい。うまくいかないようです...

/ヨハン

4

1 に答える 1

0

Caliburn を使用している場合は、ContentControl の View.Model 添付プロパティを使用してこれを実現できます。

于 2010-02-22T19:46:50.307 に答える