我正在尝试按下按钮(在我的主窗口中)打开一个新的WPF窗口。我收到此错误
KPI_Generator_v3.completedWindow' KPI_Generator_v3.completedWindow'的部分声明不得指定不同的基类 在新窗口的XAML.CS
的第9行你能帮我解决一下并解释发生了什么吗?我仍然很新,从谷歌搜索最后一小时,我觉得这是一个非常简单的错误,但我不能为我的生活解决它。
以下是新窗口的XAML:
<Controls:MetroWindow x:Class="KPI_Generator_v3.completedWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
Title="completedWindow" Height="300" Width="300">
<Grid>
<Button Content="Button" HorizontalAlignment="Left" Margin="104,82,0,0"
VerticalAlignment="Top" Width="75" Click="Button_Click"/>
</Grid>
</Controls:MetroWindow>
这是我的新窗口的XAML.CS:
using System.Windows;
using MahApps.Metro.Controls;
namespace KPI_Generator_v3
{
public partial class completedWindow : MetroWindow
{
public completedWindow()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
}
}
}
现在我的主窗口XAML
<Controls:MetroWindow x:Class="KPI_Generator_v3.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
Title="Utilities" Height="538" Width="1000" >
<Grid Margin="0,0,0,100">
<Menu DockPanel.Dock="Top" Margin="21,0,0,358">
<MenuItem x:Name="fileMNU" Header="_File" Width="43" >
<MenuItem x:Name="exitMNU" Header="_Exit" Click="exit_Click" />
</MenuItem>
</Grid>
</Controls:MetroWindow>
最后是我主窗口的XAML.CS
using System;
using System.Windows;
using MahApps.Metro.Controls;
using System.Windows.Forms;
using Excel = Microsoft.Office.Interop.Excel;
namespace KPI_Generator_v3
{
public partial class MainWindow : MetroWindow
{
string[] result;
Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
string[] fileNameNoExt;
public MainWindow()
{
InitializeComponent();
}
}
}
谢谢