他のウィンドウのベース ウィンドウとして使用したい WPF のカスタム ウィンドウがあります。
継承しようとすると、XAML に次のように記述しました。
<my:MyWindow x:Class="NewWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:my="clr-namespace:MyNamesapce;assembly=MyAssembly"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
私が書いた.csコードで:
namespace SomeOtherNamespace
{
public partial class NewWindow: MyWindow
{
internal NewWindow(Control ctrl) : base(ctrl)
{
InitializeComponent();
this.ResizeMode = System.Windows.ResizeMode.NoResize;
}
}
}
しかし、その後、エラーが発生しました:
XAML を使用して定義されているため、XAML ファイルのルートにすることはできません。
私は何を間違っていますか?どうすれば修正できますか?