Caliburn Micro MVVM获取组合框以显示ViewModel屏幕

Caliburn Micro MVVM获取组合框以显示ViewModel屏幕,mvvm,combobox,caliburn.micro,Mvvm,Combobox,Caliburn.micro,我有一个组合框,可以在ViewModel中完美地显示其中的列表,但我希望它能够在选中列表中的某个项目时触发ViewModel屏幕,并且我只希望列表中的一个可以这样做? 以下是我在ChooseView中看到的内容: <ComboBox x:Name="CatalogName1" SelectedItem="{Binding SelectedCatalog1}" Style="{DynamicResource appComboBox}" Grid.Row="1" Grid.Column="1"

我有一个组合框,可以在ViewModel中完美地显示其中的列表,但我希望它能够在选中列表中的某个项目时触发ViewModel屏幕,并且我只希望列表中的一个可以这样做? 以下是我在ChooseView中看到的内容:

<ComboBox x:Name="CatalogName1" SelectedItem="{Binding SelectedCatalog1}" Style="{DynamicResource appComboBox}" Grid.Row="1" Grid.Column="1"  >
    </ComboBox>
在ChooseViewModel中:

public List<string> CatalogName1
    {
        get
        {
            return new List<string> { "New", "Replace", "Extended", "Nothing", "ShowScreen" };
        }


    }

     private string selectedCatalog1;
    public string SelectedCatalog1
    {
        get
        {
            return this.selectedCatalog1;
        }

        set
        {
            this.selectedCatalog1 = value;
            this.NotifyOfPropertyChange(() => this.SelectedCatalog1);
        }
    }

组合列表中的ShowScreen应该显示ShowScreenViewModel,但我已经尝试使用getter setter,它对我来说没有意义好的,这是我解决问题的方法

private string selectedCatalog1;
    public string SelectedCatalog1
    {
        get
        {
            return selectedCatalog1;
        }
        set
        {
            selectedCatalog1 = value;
            ValidateValue(value);
            NotifyOfPropertyChange(() => SelectedCatalog1);
        }
    }
    private void ValidateValue(string s)
    {
        if (s == "ShowScreen")
        {
            ActivateItem(new ShowScreenViewModel());
        }
    }

您应该创建一个方法来检查集合中的值是否等于ShowScreen。如果是这样,那么激活你的ViewModel,否则只需设置文本,然后调用notify。我该如何使用该方法,对不起,我应该说我对所有这些绑定和caliburn都是新手?你是说如何激活你的ViewModel,或者如何检查你是否单击了ShowScreen?没有。将集合属性转换为{get;private set;}。每次退回新的收藏都很糟糕。您也没有将其绑定到ItemsSource,那么您希望如何在组合框中显示任何内容?@arcticwhite如何检查其是否已被单击,我猜是itemsource,因为我已经选择了EdItem,没有一个示例显示如何显示新屏幕。如果我有click按钮,它将是一个公共的无效显示屏幕{ActivateItemShowScreenViewModel.getinstance;}