C# 不包含';显示';没有扩展方法';显示';错误

C# 不包含';显示';没有扩展方法';显示';错误,c#,wpf,xaml,C#,Wpf,Xaml,我试图用下面的代码显示PluginManagerView的一个实例 此XAML文件位于同一命名空间、同一项目中。但是我在mainwindow.Show()的行中出错这么说 Error 1 'PluginManager.PluginManagerView' does not contain a definition for 'Show' and no extension method 'Show' accepting a first argument of type 'PluginManager.

我试图用下面的代码显示PluginManagerView的一个实例

此XAML文件位于同一命名空间、同一项目中。但是我在
mainwindow.Show()的行中出错这么说

Error 1 'PluginManager.PluginManagerView' does not contain a definition for 'Show' and no extension method 'Show' accepting a first argument of type 'PluginManager.PluginManagerView' could be found (are you missing a using directive or an assembly reference?) Blah procedyre .cs  30  24  PluginManager
有人能告诉我问题出在哪里吗?为什么它不抛出以前使用MainWindow时的错误呢

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
using System.ComponentModel.Composition.Hosting;

namespace PluginManager
{
    public class PublicProcedures : Application
    {
        public static void ShowPlugins()
        {
            var mainwindow = new PluginManagerView();

            //An aggregate catalog that combines multiple catalogs

            var catalog = new AggregateCatalog();
            //Adds all the parts found in the same assembly as the Program class
            //catalog.Catalogs.Add(new AssemblyCatalog(this.GetType().Assembly));
            catalog.Catalogs.Add(new DirectoryCatalog("./Plugins/"));

            var container = new CompositionContainer(catalog);

            var modules = container.GetExportedValues<IPlugin>();


            mainwindow.DataContext = modules;
            mainwindow.Show();
        }

    }


}
使用系统;
使用System.Collections.Generic;
使用系统配置;
使用系统数据;
使用System.Linq;
使用System.Windows;
使用System.ComponentModel.Composition.Hosting;
命名空间插件管理器
{
公开课程序:申请
{
公共静态void ShowPlugins()
{
var main window=new PluginManagerView();
//组合多个目录的聚合目录
var catalog=new AggregateCatalog();
//添加与程序类在同一部件中找到的所有零件
//catalog.Catalogs.Add(新的AssemblyCatalog(this.GetType().Assembly));
catalog.Catalogs.Add(新目录目录(“./Plugins/”);
var容器=新的合成容器(目录);
var modules=container.GetExportedValues();
mainwindow.DataContext=模块;
mainwindow.Show();
}
}
}

它抱怨说,无论
PluginManagerView
是什么,它都没有
Show
方法(您试图在名为“mainwindow”的
PluginManagerView的实例中调用该方法)。

为了调用(我猜这就是您想要做的),PluginManagerView必须从类派生,它的XAML必须看起来像这样:

<Window x:Class="PluginManager.PluginManagerView" ...>
    ...
</Window>

...