找到沒有匹配的構造函數我有一個WPF應用程序,我使用多個窗體。有一個主要表格在我們啓動應用程序時被打開,它被稱爲MainWindow.xaml
。這個表單有多種形式,根據用戶選項打開。有一個表格StartClassWindow.xaml
。目前我正在處理這個表格,所以我希望它直接開始而不是MainWindow.xaml
。因此,要做到這一點,我改變了app.xaml startupuri
:錯誤:在類型
<Application x:Class="Class.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
DispatcherUnhandledException="Application_DispatcherUnhandledException"
StartupUri="StartClassWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>
但後來它開始給錯誤象下面這樣:
No matching constructor found on type 'Class.StartClassWindow'. You can use the Arguments or FactoryMethod directives to construct this type.' Line number '3' and line position '9'.
這裏是StartClassWindow.xaml.cs
:
namespace Class
{
public partial class StartClassWindow : System.Windows.Window
{
public StartClassWindow(string classData)
{
InitializeComponent();
className = classData;
function();
}
//rest of the code.
}
}