在类库中,我定义了以下类:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
namespace mylirary
{
public class MainWindow : Window
{
}
}
在另一个项目的某个地方,我尝试实例化并显示窗口,但这是不可能的。它没有Show()
方法!
var mw = new MainWindow();
mw.Show();
请问您能告诉我如何从类库中的WPF
窗口类继承?
Error 9 'mylirary.MainWindow' does not contain a definition for
'Show' and no extension method 'Show' accepting a first argument of type
'mylirary.MainWindow' could be found (are you missing a using directive or
an assembly reference?)