我有我的'窗口'繼承問題,我不明白是什麼問題?c# - 繼承WPF佈局 - 來自窗口的窗口
我想,我的佈局(MediaLibrary.xaml)要繼承主窗口的......但我不知道如何做到這一點:/
有2類:
MainWindow.xaml
<Window x:Class="WindowsMediaPlayerV2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MyWindowsMediaPlayer v2" Height="350" Width="525" MinHeight="350" MinWidth="525">
<Grid>
</Grid>
</Window>
MainWindow.xaml.cs
namespace WindowsMediaPlayerV2
{
public partial class MainWindow : Window
{
public MediaLibrary myMediaLibrary = new MediaLibrary();
public MainWindow()
{
InitializeComponent();
}
}
}
MediaLibrary.xaml
<Window x:Class="WindowsMediaPlayerV2.MediaLibrary"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MediaLibrary" Height="350" Width="300" MinHeight="350" MinWidth="300" Closing="Window_Closing">
<Grid>
</Grid>
</Window>
MediaLibrary.xaml.cs當我運行
namespace WindowsMediaPlayerV2
{
public partial class MediaLibrary : MainWindow //problem here when I run
{
public MediaLibrary()
{
InitializeComponent();
}
}
}
錯誤:
FR:萊斯聲明partielles德 'WindowsMediaPlayerV2.MediaLibrary' NE doivent passpécifierdes classes de basedifférentes
EN:'WindowsMediaPlayerV2.MediaLibrary'的部分聲明不能指定不同的基類 我們可以幫助我嗎?謝謝